{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nopaque-co-uk/json-schema/nopaque-co-uk-schedule-schema.json",
  "title": "Schedule",
  "description": "Workspace-scoped schedule. Fires via the SchedulerTrigger EventBridge rule every\nminute — `nextRunAt` is recomputed on each fire and the `runCount` increments.\n\nPause/resume toggles `enabled` between `'true'` and `'false'` (string-typed for\nDDB GSI keying; the JSON serialization reflects that string form verbatim).\n",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nopaque-co-uk-schedules-api-openapi.yml#/components/schemas/Schedule",
  "type": "object",
  "required": [
    "id",
    "workspaceId",
    "name",
    "scheduleType",
    "timezone",
    "enabled",
    "nextRunAt",
    "runCount",
    "createdAt",
    "updatedAt",
    "createdBy"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "workspaceId": {
      "type": "string",
      "format": "uuid"
    },
    "targetId": {
      "type": "string",
      "description": "Optional — target test-config id, map id, or batch id depending on `targetType`."
    },
    "targetType": {
      "$ref": "#/$defs/ScheduleTargetType"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "scheduleType": {
      "$ref": "#/$defs/ScheduleType"
    },
    "cronExpression": {
      "type": "string",
      "description": "5-field cron expression (minute hour day-of-month month day-of-week), required\nwhen `scheduleType: cron`. Validated server-side.\n"
    },
    "intervalMinutes": {
      "type": "integer",
      "minimum": 1,
      "description": "Interval in minutes, required when `scheduleType: recurring`."
    },
    "runAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601 timestamp the schedule should fire at, required when `scheduleType: once`.\nMust be in the future at create-time.\n"
    },
    "timezone": {
      "type": "string",
      "description": "IANA timezone identifier used to evaluate cron expressions."
    },
    "enabled": {
      "type": "string",
      "enum": [
        "true",
        "false"
      ],
      "description": "String-typed boolean (DDB GSI key constraint). `'true'` = active, `'false'` =\npaused. Toggle via `pauseSchedule` / `resumeSchedule`.\n"
    },
    "lastRunAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp of the most recent trigger. Absent until the first fire."
    },
    "nextRunAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp the schedule will next fire. Recomputed on each successful trigger."
    },
    "runCount": {
      "type": "integer",
      "minimum": 0,
      "description": "Total number of times this schedule has been triggered."
    },
    "eventBridgeRuleArn": {
      "type": "string",
      "description": "ARN of the underlying EventBridge rule (when one is attached). Present for legacy schedules only."
    },
    "eventBridgeRuleName": {
      "type": "string",
      "description": "Name of the underlying EventBridge rule (when one is attached). Present for legacy schedules only."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "createdBy": {
      "type": "string"
    }
  },
  "$defs": {
    "ScheduleTargetType": {
      "type": "string",
      "enum": [
        "test",
        "map",
        "batch"
      ],
      "description": "Target kind when the schedule has a direct attachment. `test` triggers a test\nrun, `map` triggers a mapping job, `batch` triggers a batch dispatch. Optional —\nschedules without `targetId`/`targetType` are reusable templates (handled by\ndownstream orchestration).\n"
    },
    "ScheduleType": {
      "type": "string",
      "enum": [
        "once",
        "recurring",
        "cron"
      ],
      "description": "Trigger semantics. `once` fires at the specific `runAt` timestamp; `recurring`\nfires every `intervalMinutes`; `cron` fires according to the supplied\n`cronExpression` (5-field cron syntax interpreted in `timezone`).\n"
    }
  }
}