{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://vclaw.dev/schemas/video/artifacts/motion-sheet.schema.json",
  "title": "MotionSheetArtifact",
  "type": "object",
  "required": ["schemaVersion", "projectSlug", "sheetId", "family", "generatedAt", "styleLock", "negative"],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": { "const": 1 },
    "projectSlug": { "type": "string", "minLength": 1 },
    "sheetId": { "type": "string", "minLength": 1, "pattern": "^[A-Za-z0-9][A-Za-z0-9-]*$" },
    "family": { "type": "string", "minLength": 1 },
    "generatedAt": { "type": "string", "format": "date-time" },
    "canonicalDescription": { "type": "string" },
    "masterImagePrompt": { "type": "string" },
    "styleLock": { "type": "string", "minLength": 1 },
    "negative": { "type": "string", "minLength": 1 },
    "audioIdentity": { "type": "string" },
    "energy": { "type": "string" },
    "stage": { "$ref": "#/definitions/Stage" },
    "hero": {
      "type": "object",
      "additionalProperties": false,
      "required": ["descriptor", "anchor"],
      "properties": {
        "descriptor": { "type": "string", "minLength": 1 },
        "anchor": { "type": "string", "minLength": 1 }
      }
    },
    "budget": { "type": "string", "enum": ["fleet", "film"] },
    "refImage": { "$ref": "#/definitions/RefImage" },
    "refImageHistory": {
      "type": "array",
      "items": { "$ref": "#/definitions/RefImage" }
    },
    "logoRefs": {
      "type": "array",
      "items": { "$ref": "#/definitions/LogoRef" }
    },
    "palette": {
      "type": "array",
      "items": { "$ref": "#/definitions/PaletteEntry" }
    },
    "typeRoles": {
      "type": "array",
      "items": { "$ref": "#/definitions/TypeRole" }
    },
    "components": {
      "type": "array",
      "items": { "type": "string", "minLength": 1 }
    },
    "gotchas": {
      "type": "array",
      "items": { "type": "string", "minLength": 1 }
    },
    "locked": { "type": "boolean" },
    "version": { "type": "integer", "minimum": 1 }
  },
  "definitions": {
    "Stage": {
      "type": "object",
      "required": ["mode"],
      "additionalProperties": false,
      "properties": {
        "mode": { "enum": ["locked", "free"] },
        "description": { "type": "string" }
      }
    },
    "RefImage": {
      "type": "object",
      "required": ["path", "version"],
      "additionalProperties": false,
      "properties": {
        "path": { "type": "string", "minLength": 1 },
        "version": { "type": "integer", "minimum": 1 },
        "approvedAt": { "type": "string", "format": "date-time" }
      }
    },
    "LogoRef": {
      "type": "object",
      "required": ["brand", "path"],
      "additionalProperties": false,
      "properties": {
        "brand": { "type": "string", "minLength": 1 },
        "path": { "type": "string", "minLength": 1 },
        "source": { "type": "string" }
      }
    },
    "PaletteEntry": {
      "type": "object",
      "required": ["name", "hex"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string", "minLength": 1 },
        "hex": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" },
        "role": { "type": "string" }
      }
    },
    "TypeRole": {
      "type": "object",
      "required": ["role", "treatment"],
      "additionalProperties": false,
      "properties": {
        "role": { "type": "string", "minLength": 1 },
        "treatment": { "type": "string", "minLength": 1 }
      }
    }
  }
}
