{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://wouldliker.com/data/schemas/sound-brief.schema.json",
  "title": "Wouldliker Sound Brief",
  "type": "object",
  "required": ["sound_brief_version", "clip", "sound_behavior"],
  "properties": {
    "sound_brief_version": { "type": "string" },
    "mode": { "enum": ["clip_to_sound", "sound_to_plan"] },
    "clip": {
      "type": "object",
      "required": ["topic", "platform"],
      "properties": {
        "topic": { "type": "string" },
        "duration_s": { "type": "integer", "minimum": 1 },
        "platform": { "enum": ["tiktok"] },
        "market": { "type": "string" },
        "voiceover": { "type": "boolean" },
        "commercial_use": { "type": "boolean" },
        "paid_ad": { "type": "boolean" },
        "off_platform_reuse": { "type": "boolean" },
        "aigc": { "type": "boolean" },
        "payoff_at_ms": { "type": ["integer", "null"], "minimum": 0 }
      },
      "additionalProperties": true
    },
    "route": { "type": "string" },
    "sound_behavior": { "$ref": "#/$defs/sound_behavior" },
    "flow_guidance": { "type": "object" },
    "payoff_guidance": { "type": ["object", "null"] },
    "beat_map": { "type": ["object", "null"] },
    "template_pack": { "type": ["object", "null"] },
    "agent_prompt_pack": { "type": "object" },
    "risk_assessment": { "type": "object" }
  },
  "additionalProperties": true,
  "$defs": {
    "sound_behavior": {
      "type": "object",
      "required": [
        "energy_shape",
        "density",
        "role",
        "voiceover_safe",
        "hook_starts_at_ms",
        "payoff_required",
        "loop_friendly",
        "recommended_lengths_s",
        "edit_guidance",
        "first_second_priority",
        "interference_risk"
      ],
      "properties": {
        "sound_slug": { "type": "string" },
        "name": { "type": "string" },
        "energy_shape": { "enum": ["steady", "rising", "punchy"] },
        "density": { "enum": ["low", "medium", "high"] },
        "role": {
          "enum": [
            "background_bed",
            "hook_pressure",
            "reveal_support",
            "voice_safe_motion"
          ]
        },
        "voiceover_safe": { "type": "boolean" },
        "hook_starts_at_ms": { "type": "integer", "minimum": 0 },
        "payoff_required": { "type": "boolean" },
        "loop_friendly": { "type": "boolean" },
        "recommended_lengths_s": {
          "type": "array",
          "items": { "type": "integer", "enum": [15, 30, 60, 90, 120] },
          "minItems": 1
        },
        "edit_guidance": { "type": "string" },
        "first_second_priority": {
          "enum": ["subject_in_frame", "hook_text", "motion", "face"]
        },
        "interference_risk": { "enum": ["low", "medium", "high"] }
      },
      "additionalProperties": false
    }
  }
}
