{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/SimulationRun",
  "title": "SimulationRun",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the run",
      "format": "uuid"
    },
    "orgId": {
      "type": "string",
      "description": "Organization ID",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "ended"
      ],
      "description": "Current status of the run"
    },
    "queuedAt": {
      "format": "date-time",
      "type": "string",
      "description": "When the run was queued"
    },
    "startedAt": {
      "format": "date-time",
      "type": "string",
      "description": "When the run started"
    },
    "endedAt": {
      "format": "date-time",
      "type": "string",
      "description": "When the run ended"
    },
    "endedReason": {
      "type": "string",
      "description": "Reason the run ended"
    },
    "createdAt": {
      "format": "date-time",
      "type": "string",
      "description": "ISO 8601 date-time when created"
    },
    "updatedAt": {
      "format": "date-time",
      "type": "string",
      "description": "ISO 8601 date-time when last updated"
    },
    "itemCounts": {
      "description": "Aggregate counts of run items by status",
      "allOf": [
        {
          "$ref": "#/components/schemas/SimulationRunItemCounts"
        }
      ]
    },
    "simulations": {
      "type": "array",
      "description": "Array of simulations and/or suites to run",
      "items": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/SimulationRunSimulationEntry",
            "title": "Simulation"
          },
          {
            "$ref": "#/components/schemas/SimulationRunSuiteEntry",
            "title": "Suite"
          }
        ]
      }
    },
    "target": {
      "description": "Target to test against",
      "oneOf": [
        {
          "$ref": "#/components/schemas/SimulationRunTargetAssistant",
          "title": "Assistant"
        },
        {
          "$ref": "#/components/schemas/SimulationRunTargetSquad",
          "title": "Squad"
        }
      ]
    },
    "iterations": {
      "type": "number",
      "minimum": 1,
      "description": "Number of times to run each simulation (default: 1)",
      "default": 1
    },
    "transport": {
      "description": "Transport configuration for the simulation runs",
      "allOf": [
        {
          "$ref": "#/components/schemas/SimulationRunTransportConfiguration"
        }
      ]
    }
  },
  "required": [
    "id",
    "orgId",
    "status",
    "queuedAt",
    "createdAt",
    "updatedAt",
    "simulations",
    "target"
  ]
}