{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "slidetemplate.schema.json",
  "title": "Slide Template",
  "type": "object",
  "description": "CTK ingestion contract for an OpenSciEd slide template: a reusable, named layout of absolutely-positioned elements on the authoring canvas that a Slide is bootstrapped from. The source is aligned to the Doolittle slide contract (canvas + elements + optional grid). Fillable elements (type=null) carry a slot; other elements are pre-filled decoration. The content-item envelope (type, template_id, name, ...) is optional and derived during ingestion when absent.",
  "required": [ "type", "canvas", "elements" ],
  "properties": {
    "type": {
      "type": "string",
      "const": "slidetemplate",
      "description": "When present, must be 'slidetemplate'."
    },
    "sourceId": {
      "type": "string",
      "description": "Optional source identifier; a deterministic one is derived at ingestion when absent."
    },
    "spinetags": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": { "type": "string" }
    },
    "securitylevel": {
      "type": "string",
      "enum": [ "standard", "high" ]
    },
    "approved": {
      "type": "boolean"
    },
    "template_id": {
      "type": "string",
      "pattern": "^T-(0[1-9]|1[0-9])$",
      "description": "Optional template id from the authoritative T-01..T-19 namespace (design-spec/SLIDE-SPEC.md).",
      "examples": [ "T-01", "T-06", "T-14" ]
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "description": "Optional human-readable template name (e.g. 'Discussion Prompt')."
    },
    "description": {
      "type": "string",
      "description": "Optional description of what the template is used for."
    },
    "render_template": {
      "type": "string",
      "description": "Optional renderer key this template maps to (mirrors slide.render_template)."
    },
    "canvas": { "$ref": "slide-canvas.schema.json" },
    "grid": {
      "anyOf": [
        { "type": "null" },
        { "$ref": "slide-grid.schema.json" }
      ],
      "description": "Optional authoring grid; null for a purely absolute-positioned template."
    },
    "elements": {
      "type": "array",
      "description": "The elements that make up the template layout. May be empty for a blank template.",
      "items": { "$ref": "slidetemplate-element.schema.json" }
    }
  },
  "additionalProperties": true
}
