"""B' judge-only 재평가: S19 sh5(극단 오버헤드 단일샷)가 새 prompt/schema로
single_shot_complexity + camera_or_framing_risk 로 admit 되는지 확인.
provider 를 직접 호출(코드 변경 반영). read-only, judge LLM 1콜.
"""
import json
import sys
sys.path.insert(0, "backend")

from app.modules.pipeline.outdoor_site_layout_provider import judge_shared_model_guide

S19_CAMDIR = ("From a high, CCTV-adjacent position on the exterior wall, the camera "
              "looks steeply down at 수리영 as she lifts her chin directly into the lens, "
              "making the surveillance point feel like an accuser. She is centered below "
              "with a slice of store wall and dull morning sky around her, her raised "
              "face confronting the lens.")

group_payload = {
    "location_id": "L08",
    "scene_index": 19,
    "cameras_non_identical": False,
    "landmark_count": 6,
    "shots": [{
        "shot_key": "19:5",
        "signals": {"entity_count_bucket": "single", "entity_count": 1,
                    "depth_planes": 1, "has_motion": False},
        "camera_direction": S19_CAMDIR,
        "frame_spatial_contract": {},
        "camera_view_brief": None,
        "raw_director_fields_for_judge": {
            "camera_direction": S19_CAMDIR,
            "framing_scale": "medium",
            "shot_type": None,
        },
        "seed_lane": "single_shot_complexity",
        "why_candidate": "single_shot_outdoor_figure_present",
        "location_source": "frame_visible",
        "visible_location_present": True,
        "figure_count": 1,
        "framing_scale": "medium",
        "character_angle_count": 1,
        "frame_spatial_contract_present": False,
        "available_structural_signal_names": ["framing_scale", "character_angles"],
    }],
}

verdict = judge_shared_model_guide(
    group_payload, model="gemini-3.1-pro-preview",
    log_context={"operation_type": "bprime_judge_eval_S19sh5"})
print(json.dumps(verdict, ensure_ascii=False, indent=1))
print("\n=== 판정 ===")
print("needs:", verdict.get("needs_shared_model_guide"))
print("decision_type:", verdict.get("decision_type"))
print("confidence:", verdict.get("confidence"))
print("reasons:", verdict.get("reasons"))
ev = verdict.get("evidence") or []
print("evidence source_fields:", [e.get("source_field") for e in ev])
