{
  "$schema": "https://json-schema.org/draft/2020-12",
  "$id": "https://spxgraphics.com/schemas/rundown-item",
  "title": "SPX Rundown Item",
  "description": "A rundown item representing a graphics template entry in an SPX-GC production rundown.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the rundown item",
      "example": "item-001"
    },
    "name": {
      "type": "string",
      "description": "Display name of the rundown item",
      "example": "Lower Third - John Smith"
    },
    "template": {
      "type": "string",
      "description": "Path to the HTML template file relative to TEMPLATES folder",
      "example": "templates/lowerthird.html"
    },
    "status": {
      "type": "string",
      "description": "Current playback status of the item",
      "enum": ["idle", "playing", "stopped"],
      "example": "idle"
    },
    "fields": {
      "type": "array",
      "description": "Template field values for this rundown item",
      "items": {
        "$ref": "#/$defs/TemplateField"
      }
    },
    "out": {
      "type": "string",
      "description": "Output target (e.g., CasparCG, OBS, vMix)",
      "example": "CasparCG"
    },
    "playDelay": {
      "type": "integer",
      "description": "Delay in milliseconds before playing",
      "default": 0,
      "minimum": 0
    },
    "notes": {
      "type": "string",
      "description": "Operator notes for this rundown item",
      "example": "Interview segment - play after intro"
    }
  },
  "required": ["template"],
  "$defs": {
    "TemplateField": {
      "type": "object",
      "description": "A template variable name/value pair",
      "properties": {
        "field": {
          "type": "string",
          "description": "Field name matching the template variable (e.g., f0, f1, title)",
          "example": "f0"
        },
        "value": {
          "type": "string",
          "description": "Value to assign to the field",
          "example": "John Smith"
        }
      },
      "required": ["field", "value"]
    }
  }
}
