{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Episode Breakdown",
  "description": "Visual breakdown of a narrative episode — the shot list produced by the Breakdown Agent",
  "type": "object",
  "required": ["episode_id", "format", "beats", "global_audio"],
  "properties": {
    "episode_id": { "type": "string", "pattern": "^ep_\\d{2}$" },
    "format": { "type": "string" },
    "grammar": {
      "type": "object",
      "description": "Per-character visual grammar applied to this episode",
      "properties": {
        "primary_character": { "type": "string" },
        "lens": { "type": "string" },
        "dof": { "type": "string" },
        "color_temp": { "type": "string" },
        "bleed_factor": { "type": "number", "minimum": 0, "maximum": 1 }
      }
    },
    "global_audio": {
      "type": "object",
      "required": ["ambient_bed"],
      "properties": {
        "ambient_bed": { "type": "string" },
        "vo_character": { "type": "string" },
        "vo_text": { "type": "string" },
        "vo_delivery": { "type": "string" }
      }
    },
    "beats": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["beat_id", "duration_s", "shots"],
        "properties": {
          "beat_id": { "type": "string", "enum": ["entry_image", "voice", "linger", "break", "aftermath"] },
          "duration_s": { "type": "number" },
          "shots": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["shot_id", "shot_type", "action"],
              "properties": {
                "shot_id": { "type": "string" },
                "shot_type": { "type": "string" },
                "lens": { "type": "string" },
                "dof": { "type": "string" },
                "color_temp": { "type": "string" },
                "lighting": { "type": "string" },
                "camera_movement": { "type": "string" },
                "action": { "type": "string" },
                "characters": { "type": "array", "items": { "type": "string" } },
                "props": { "type": "array", "items": { "type": "string" } },
                "sfx": { "type": "array", "items": { "type": "string" } },
                "duration_s": { "type": "number" }
              }
            }
          }
        }
      }
    }
  }
}
