{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/codai-ro/json-schema/codai-ro-schedule-run-schema.json",
  "title": "ScheduleRun",
  "description": "One execution of a schedule.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/codai-ro-schedules-api-openapi.yml#/components/schemas/ScheduleRun",
  "type": "object",
  "required": [
    "id",
    "schedule_id",
    "state",
    "attempt",
    "scheduled_for"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "schedule_id": {
      "type": "string",
      "format": "uuid"
    },
    "scheduled_for": {
      "type": "string",
      "format": "date-time"
    },
    "state": {
      "type": "string",
      "enum": [
        "pending",
        "awaiting_approval",
        "claimed",
        "running",
        "succeeded",
        "failed",
        "timed_out",
        "skipped",
        "cancelled"
      ]
    },
    "attempt": {
      "type": "integer"
    },
    "device_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "finished_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "exit_code": {
      "type": [
        "integer",
        "null"
      ]
    },
    "cost_micro_usd": {
      "type": [
        "integer",
        "null"
      ]
    },
    "log_tail": {
      "type": [
        "string",
        "null"
      ]
    },
    "session_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}