{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nopaque-co-uk/json-schema/nopaque-co-uk-create-schedule-request-schema.json",
  "title": "CreateScheduleRequest",
  "description": "Body for `POST /schedules`. The combination of `scheduleType` + the type-specific\nfield (cronExpression / intervalMinutes / runAt) determines the trigger semantics.\n\n`targetId` + `targetType` are optional — omitting them creates a reusable schedule\ntemplate that orchestration code can dispatch against.\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/CreateScheduleRequest",
  "type": "object",
  "required": [
    "name",
    "scheduleType"
  ],
  "properties": {
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "targetId": {
      "type": "string"
    },
    "targetType": {
      "$ref": "#/$defs/ScheduleTargetType"
    },
    "scheduleType": {
      "$ref": "#/$defs/ScheduleType"
    },
    "cronExpression": {
      "type": "string",
      "description": "Required when `scheduleType: cron`."
    },
    "intervalMinutes": {
      "type": "integer",
      "minimum": 1,
      "description": "Required when `scheduleType: recurring`."
    },
    "runAt": {
      "type": "string",
      "format": "date-time",
      "description": "Required when `scheduleType: once`. Must be in the future."
    },
    "timezone": {
      "type": "string",
      "description": "IANA timezone identifier. Defaults to `UTC` when omitted."
    }
  },
  "$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"
    }
  }
}