{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/trigger-dev/main/json-schema/trigger-dev-schedule-schema.json",
  "title": "Trigger.dev Schedule",
  "description": "A scheduled task configuration in Trigger.dev",
  "type": "object",
  "required": ["id", "task"],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^sched_",
      "description": "Schedule identifier (prefixed with sched_)"
    },
    "task": {
      "type": "string",
      "description": "Task identifier that this schedule triggers"
    },
    "type": {
      "type": "string",
      "enum": ["IMPERATIVE", "DECLARATIVE"],
      "description": "Schedule type: IMPERATIVE (created via API) or DECLARATIVE (defined in code)"
    },
    "active": {
      "type": "boolean",
      "description": "Whether the schedule is currently active"
    },
    "deduplicationKey": {
      "type": "string",
      "description": "Key to prevent duplicate schedules"
    },
    "externalId": {
      "type": "string",
      "description": "Custom external identifier for the schedule"
    },
    "timezone": {
      "type": "string",
      "description": "IANA timezone identifier (e.g., America/New_York)"
    },
    "nextRun": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 datetime of the next scheduled execution"
    },
    "generator": {
      "type": "object",
      "properties": {
        "type": { "type": "string", "enum": ["CRON"] },
        "expression": { "type": "string", "description": "Cron expression" },
        "description": { "type": "string", "description": "Human-readable schedule description" }
      }
    },
    "environments": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "type": { "type": "string", "enum": ["DEVELOPMENT", "STAGING", "PRODUCTION"] }
        }
      }
    }
  }
}
