{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://vclaw.dev/schemas/video/artifacts/motion-pack.schema.json",
  "title": "MotionPackArtifact",
  "type": "object",
  "required": ["schemaVersion", "projectSlug", "video", "sheetId", "generatedAt", "aspect", "durationSec", "timing", "blocks"],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": { "const": 1 },
    "projectSlug": { "type": "string", "minLength": 1 },
    "video": { "type": "string", "minLength": 1 },
    "sheetId": { "type": "string", "minLength": 1 },
    "generatedAt": { "type": "string", "format": "date-time" },
    "route": { "type": "string" },
    "model": { "type": "string" },
    "aspect": { "type": "string", "pattern": "^\\d+:\\d+$" },
    "durationSec": { "type": "integer", "minimum": 1, "maximum": 60 },
    "timing": { "enum": ["draft", "final"] },
    "logoRefs": {
      "type": "array",
      "items": { "type": "string", "minLength": 1 }
    },
    "copyList": {
      "type": "array",
      "items": { "type": "string", "minLength": 1 }
    },
    "coverage": {
      "type": "array",
      "items": { "$ref": "#/definitions/CoverageRow" }
    },
    "blocks": {
      "type": "array",
      "items": { "$ref": "#/definitions/PackBlock" }
    }
  },
  "definitions": {
    "CoverageRow": {
      "type": "object",
      "required": ["segment", "t0Sec", "t1Sec", "plan"],
      "additionalProperties": false,
      "properties": {
        "segment": { "type": "string", "minLength": 1 },
        "t0Sec": { "type": "number", "minimum": 0 },
        "t1Sec": { "type": "number", "minimum": 0 },
        "voGist": { "type": "string" },
        "plan": { "enum": ["generated", "v2v", "talking-head", "screen-rec", "reuse"] },
        "blockIds": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    },
    "PackBlock": {
      "type": "object",
      "required": ["id", "t0Sec", "t1Sec", "priority", "mode", "action"],
      "additionalProperties": false,
      "properties": {
        "id": { "type": "string", "pattern": "^B\\d{3}[a-z]?$" },
        "t0Sec": { "type": "number", "minimum": 0 },
        "t1Sec": { "type": "number", "minimum": 0 },
        "priority": { "enum": ["P1", "P2", "P3"] },
        "mode": { "enum": ["t2v", "ref2v", "v2v-stylize", "v2v-overlay", "v2v-transition", "v2v-inset"] },
        "vo": { "type": "string" },
        "sfx": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        },
        "refs": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        },
        "loop": { "type": "boolean" },
        "videoSource": { "type": "string" },
        "action": { "type": "string", "minLength": 1 }
      }
    }
  }
}
