{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "rationale_summary": {
      "type": "string",
      "maxLength": 240,
      "description": "분석 요약 1~2문장 한국어 (최대 240자)"
    },
    "floor_plans": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "description": "도면 ID, snake_case ASCII, e.g. 'FP_L05'"
          },
          "building_group": {
            "type": "string",
            "minLength": 1,
            "description": "같은 건물 그룹 식별자, snake_case ASCII, e.g. 'okt_room'. 단독 location도 자체 식별자 부여."
          },
          "location_ids": {
            "type": "array",
            "minItems": 1,
            "items": {"type": "string"},
            "description": "이 도면에 포함되는 location short_id 목록 (실내+관련 외부)"
          },
          "primary_location_id": {
            "type": "string",
            "minLength": 1,
            "description": "도면의 주 location"
          },
          "rationale": {
            "type": "string",
            "maxLength": 120,
            "description": "왜 이 도면이 필요한지 1줄 한국어 (최대 120자)"
          },
          "shot_count": {
            "type": "integer",
            "minimum": 3,
            "description": "포함 location들의 selected shot 수 합계 (frequency rule: 최소 3)"
          },
          "needs_floor_plan": {
            "type": "boolean",
            "description": "도면 PNG 생성 필요 여부. 멤버 location 수 / state 다양성 / staging 복잡도 기준 LLM 판단. false면 PNG 생성 skip + chain_bg는 text-only로 진행."
          },
          "complexity_rationale": {
            "type": "string",
            "maxLength": 120,
            "description": "needs_floor_plan 결정 근거 1줄 한국어 (최대 120자)"
          }
        },
        "required": [
          "id",
          "building_group",
          "location_ids",
          "primary_location_id",
          "rationale",
          "shot_count",
          "needs_floor_plan",
          "complexity_rationale"
        ]
      }
    },
    "floor_plan_order": {
      "type": "array",
      "items": {"type": "string"},
      "description": "도면 ID 순서. 같은 building_group은 인접하게."
    },
    "chain_bg_groups": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "description": "chain_bg 노드 ID, snake_case ASCII, e.g. 'CB_L05_living_day'"
          },
          "floor_plan_id": {
            "type": "string",
            "minLength": 1,
            "description": "참조하는 floor_plan id"
          },
          "location_id": {
            "type": "string",
            "minLength": 1
          },
          "scenes": {
            "type": "array",
            "minItems": 1,
            "items": {"type": "integer"},
            "description": "scene_index 목록"
          },
          "shot_ids": {
            "type": "array",
            "minItems": 1,
            "items": {"type": "string"},
            "description": "S{scene}_Shot{shot} 형식"
          },
          "kind": {
            "type": "string",
            "enum": ["anchor_root", "anchor_state"]
          },
          "parent_id": {
            "type": "string",
            "description": "부모 chain_bg id, root면 빈 문자열"
          },
          "time": {
            "type": "string",
            "enum": ["day", "dusk", "night", "dawn", "none"]
          },
          "rationale": {
            "type": "string",
            "maxLength": 120
          }
        },
        "required": [
          "id",
          "floor_plan_id",
          "location_id",
          "scenes",
          "shot_ids",
          "kind",
          "parent_id",
          "time",
          "rationale"
        ]
      }
    },
    "chain_bg_order": {
      "type": "array",
      "items": {"type": "string"},
      "description": "chain_bg id 실행 순서. parent 전 child 금지."
    },
    "prev_shot_only": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "location_id": {
            "type": "string",
            "minLength": 1
          },
          "shot_count": {
            "type": "integer",
            "minimum": 1
          },
          "kind": {
            "type": "string",
            "enum": ["outdoor_3+", "low_freq_2", "single_shot"]
          },
          "rationale": {
            "type": "string",
            "maxLength": 120
          }
        },
        "required": ["location_id", "shot_count", "kind", "rationale"]
      }
    }
  },
  "required": [
    "rationale_summary",
    "floor_plans",
    "floor_plan_order",
    "chain_bg_groups",
    "chain_bg_order",
    "prev_shot_only"
  ]
}
