-- V65: 비상구 실좌표 시드 — CAD DOOR 레이어 경계 문 클러스터(±2m 밴드) 변 투영.
-- 생성기: tools/cad/extract_exit_seed.py (결정적 재생성). 근거: docs/analysis/cad-extraction.md.
-- 실측 확보 홀만 가정(is_assumed) 비상구를 대체. 분리 셔터 등 12m 초과 장스팬 제외.

-- H1: 실측 비상구 5개
DELETE FROM hall_exit WHERE hall_id = 'H1' AND is_assumed;
INSERT INTO hall_exit (id, hall_id, geom, clearance_m, is_assumed)
VALUES
    ('H1-EXIT-R1', 'H1', ST_SetSRID(ST_MakePoint(5.5, 63.0), 0), 3.0, false),
    ('H1-EXIT-R2', 'H1', ST_SetSRID(ST_MakePoint(104.0, 63.0), 0), 3.0, false),
    ('H1-EXIT-R3', 'H1', ST_SetSRID(ST_MakePoint(106.5, 63.0), 0), 3.0, false),
    ('H1-EXIT-R4', 'H1', ST_SetSRID(ST_MakePoint(171.0, 1.0), 0), 3.0, false),
    ('H1-EXIT-R5', 'H1', ST_SetSRID(ST_MakePoint(171.0, 23.0), 0), 3.0, false)
ON CONFLICT (id) DO UPDATE SET geom = EXCLUDED.geom, is_assumed = EXCLUDED.is_assumed;

-- H2: 실측 비상구 4개
DELETE FROM hall_exit WHERE hall_id = 'H2' AND is_assumed;
INSERT INTO hall_exit (id, hall_id, geom, clearance_m, is_assumed)
VALUES
    ('H2-EXIT-R1', 'H2', ST_SetSRID(ST_MakePoint(171.0, 1.0), 0), 3.0, false),
    ('H2-EXIT-R2', 'H2', ST_SetSRID(ST_MakePoint(171.0, 21.0), 0), 3.0, false),
    ('H2-EXIT-R3', 'H2', ST_SetSRID(ST_MakePoint(171.0, 32.0), 0), 3.0, false),
    ('H2-EXIT-R4', 'H2', ST_SetSRID(ST_MakePoint(171.0, 62.5), 0), 3.0, false)
ON CONFLICT (id) DO UPDATE SET geom = EXCLUDED.geom, is_assumed = EXCLUDED.is_assumed;

-- H3: 실측 비상구 4개
DELETE FROM hall_exit WHERE hall_id = 'H3' AND is_assumed;
INSERT INTO hall_exit (id, hall_id, geom, clearance_m, is_assumed)
VALUES
    ('H3-EXIT-R1', 'H3', ST_SetSRID(ST_MakePoint(171.0, 1.0), 0), 3.0, false),
    ('H3-EXIT-R2', 'H3', ST_SetSRID(ST_MakePoint(171.0, 21.0), 0), 3.0, false),
    ('H3-EXIT-R3', 'H3', ST_SetSRID(ST_MakePoint(171.0, 32.0), 0), 3.0, false),
    ('H3-EXIT-R4', 'H3', ST_SetSRID(ST_MakePoint(171.0, 62.5), 0), 3.0, false)
ON CONFLICT (id) DO UPDATE SET geom = EXCLUDED.geom, is_assumed = EXCLUDED.is_assumed;

-- H4: 실측 비상구 4개
DELETE FROM hall_exit WHERE hall_id = 'H4' AND is_assumed;
INSERT INTO hall_exit (id, hall_id, geom, clearance_m, is_assumed)
VALUES
    ('H4-EXIT-R1', 'H4', ST_SetSRID(ST_MakePoint(171.0, 1.0), 0), 3.0, false),
    ('H4-EXIT-R2', 'H4', ST_SetSRID(ST_MakePoint(171.0, 19.5), 0), 3.0, false),
    ('H4-EXIT-R3', 'H4', ST_SetSRID(ST_MakePoint(171.0, 32.0), 0), 3.0, false),
    ('H4-EXIT-R4', 'H4', ST_SetSRID(ST_MakePoint(171.0, 62.5), 0), 3.0, false)
ON CONFLICT (id) DO UPDATE SET geom = EXCLUDED.geom, is_assumed = EXCLUDED.is_assumed;

-- H5: 실측 비상구 3개
DELETE FROM hall_exit WHERE hall_id = 'H5' AND is_assumed;
INSERT INTO hall_exit (id, hall_id, geom, clearance_m, is_assumed)
VALUES
    ('H5-EXIT-R1', 'H5', ST_SetSRID(ST_MakePoint(171.0, 1.0), 0), 3.0, false),
    ('H5-EXIT-R2', 'H5', ST_SetSRID(ST_MakePoint(171.0, 32.0), 0), 3.0, false),
    ('H5-EXIT-R3', 'H5', ST_SetSRID(ST_MakePoint(171.0, 62.5), 0), 3.0, false)
ON CONFLICT (id) DO UPDATE SET geom = EXCLUDED.geom, is_assumed = EXCLUDED.is_assumed;

-- H6: 실측 비상구 8개
DELETE FROM hall_exit WHERE hall_id = 'H6' AND is_assumed;
INSERT INTO hall_exit (id, hall_id, geom, clearance_m, is_assumed)
VALUES
    ('H6-EXIT-R1', 'H6', ST_SetSRID(ST_MakePoint(0.0, 24.5), 0), 3.0, false),
    ('H6-EXIT-R2', 'H6', ST_SetSRID(ST_MakePoint(0.0, 26.5), 0), 3.0, false),
    ('H6-EXIT-R3', 'H6', ST_SetSRID(ST_MakePoint(0.0, 29.0), 0), 3.0, false),
    ('H6-EXIT-R4', 'H6', ST_SetSRID(ST_MakePoint(0.0, 42.5), 0), 3.0, false),
    ('H6-EXIT-R5', 'H6', ST_SetSRID(ST_MakePoint(0.0, 51.5), 0), 3.0, false),
    ('H6-EXIT-R6', 'H6', ST_SetSRID(ST_MakePoint(0.0, 67.5), 0), 3.0, false),
    ('H6-EXIT-R7', 'H6', ST_SetSRID(ST_MakePoint(0.0, 69.5), 0), 3.0, false),
    ('H6-EXIT-R8', 'H6', ST_SetSRID(ST_MakePoint(1.5, 93.0), 0), 3.0, false)
ON CONFLICT (id) DO UPDATE SET geom = EXCLUDED.geom, is_assumed = EXCLUDED.is_assumed;

-- H7: 실측 비상구 2개
DELETE FROM hall_exit WHERE hall_id = 'H7' AND is_assumed;
INSERT INTO hall_exit (id, hall_id, geom, clearance_m, is_assumed)
VALUES
    ('H7-EXIT-R1', 'H7', ST_SetSRID(ST_MakePoint(90, 31.0), 0), 3.0, false),
    ('H7-EXIT-R2', 'H7', ST_SetSRID(ST_MakePoint(90, 94.5), 0), 3.0, false)
ON CONFLICT (id) DO UPDATE SET geom = EXCLUDED.geom, is_assumed = EXCLUDED.is_assumed;

-- H8: 실측 비상구 4개
DELETE FROM hall_exit WHERE hall_id = 'H8' AND is_assumed;
INSERT INTO hall_exit (id, hall_id, geom, clearance_m, is_assumed)
VALUES
    ('H8-EXIT-R1', 'H8', ST_SetSRID(ST_MakePoint(0.5, 0.0), 0), 3.0, false),
    ('H8-EXIT-R2', 'H8', ST_SetSRID(ST_MakePoint(90, 22.0), 0), 3.0, false),
    ('H8-EXIT-R3', 'H8', ST_SetSRID(ST_MakePoint(90, 31.5), 0), 3.0, false),
    ('H8-EXIT-R4', 'H8', ST_SetSRID(ST_MakePoint(90, 94.5), 0), 3.0, false)
ON CONFLICT (id) DO UPDATE SET geom = EXCLUDED.geom, is_assumed = EXCLUDED.is_assumed;

-- H9: 경계 문 0개 — 신뢰 부족, 가정 비상구 유지
-- H10: 경계 문 1개 — 신뢰 부족, 가정 비상구 유지
