{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/amazon-braket/main/json-schema/braket-task-schema.json",
  "title": "Quantum Task",
  "description": "A quantum task submitted to an Amazon Braket device (QPU or simulator)",
  "type": "object",
  "properties": {
    "quantumTaskArn": {
      "type": "string",
      "description": "ARN of the quantum task",
      "pattern": "^arn:aws[a-z\\-]*:braket:[a-z0-9\\-]+:[0-9]{12}:quantum-task/[a-z0-9\\-]+$"
    },
    "deviceArn": {
      "type": "string",
      "description": "ARN of the quantum device the task is submitted to"
    },
    "shots": {
      "type": "integer",
      "description": "Number of times the circuit is executed",
      "minimum": 1
    },
    "outputS3Bucket": {
      "type": "string",
      "description": "S3 bucket for task result output"
    },
    "outputS3KeyPrefix": {
      "type": "string",
      "description": "S3 key prefix for task result output"
    },
    "status": {
      "type": "string",
      "enum": ["CREATED", "QUEUED", "RUNNING", "COMPLETED", "FAILED", "CANCELLING", "CANCELLED"],
      "description": "Current status of the quantum task"
    },
    "failureReason": {
      "type": "string",
      "description": "Reason for task failure if status is FAILED"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the task was created"
    },
    "endedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the task ended"
    },
    "tags": {
      "type": "object",
      "description": "Metadata tags for the quantum task",
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "required": ["quantumTaskArn", "deviceArn", "shots", "outputS3Bucket", "status", "createdAt"]
}
