-- ============================================================
-- 009_incidents.sql — 사고관리(Incidents) 탭 테이블 + 초기 데이터
-- ============================================================

-- 1. 사고 (ACDNT)
CREATE TABLE IF NOT EXISTS ACDNT (
  ACDNT_SN        SERIAL        NOT NULL,
  ACDNT_CD        VARCHAR(20)   NOT NULL,
  ACDNT_NM        VARCHAR(200)  NOT NULL,
  ACDNT_TP_CD     VARCHAR(50)   NOT NULL,
  ACDNT_STTS_CD   VARCHAR(20)   NOT NULL DEFAULT 'ACTIVE',
  LAT             NUMERIC(9,6),
  LNG             NUMERIC(10,6),
  LOC_DC          VARCHAR(200),
  OCCRN_DTM       TIMESTAMPTZ   NOT NULL,
  RPT_DTM         TIMESTAMPTZ,
  REGION_NM       VARCHAR(20),
  OFFICE_NM       VARCHAR(30),
  SVRT_CD         VARCHAR(10),
  VESSEL_TP       VARCHAR(30),
  PHASE_CD        VARCHAR(20) DEFAULT 'RESPONSE',
  ANALYST_NM      VARCHAR(50),
  RGTR_ID         UUID,
  USE_YN          CHAR(1) DEFAULT 'Y',
  REG_DTM         TIMESTAMPTZ   NOT NULL DEFAULT NOW(),
  MDFCN_DTM       TIMESTAMPTZ,
  CONSTRAINT PK_ACDNT PRIMARY KEY (ACDNT_SN),
  CONSTRAINT UK_ACDNT_CD UNIQUE (ACDNT_CD),
  CONSTRAINT CK_ACDNT_STTS CHECK (ACDNT_STTS_CD IN ('ACTIVE','INVESTIGATING','CLOSED')),
  CONSTRAINT CK_ACDNT_SVRT CHECK (SVRT_CD IS NULL OR SVRT_CD IN ('DANGER','ALERT','CAUTION','INTEREST')),
  CONSTRAINT CK_ACDNT_PHASE CHECK (PHASE_CD IS NULL OR PHASE_CD IN ('RESPONSE','STANDBY','CLOSED'))
);

CREATE INDEX IF NOT EXISTS IDX_ACDNT_STTS ON ACDNT(ACDNT_STTS_CD);
CREATE INDEX IF NOT EXISTS IDX_ACDNT_OCCRN ON ACDNT(OCCRN_DTM DESC);
CREATE INDEX IF NOT EXISTS IDX_ACDNT_REGION ON ACDNT(REGION_NM);

-- 2. 유출정보 (SPIL_DATA)
CREATE TABLE IF NOT EXISTS SPIL_DATA (
  SPIL_DATA_SN    SERIAL        NOT NULL,
  ACDNT_SN        INTEGER       NOT NULL,
  OIL_TP_CD       VARCHAR(50)   NOT NULL,
  SPIL_QTY        NUMERIC(14,10),
  SPIL_UNIT_CD    VARCHAR(10)   DEFAULT 'KL',
  SPIL_TP_CD      VARCHAR(20),
  FCST_HR         INTEGER,
  REG_DTM         TIMESTAMPTZ   NOT NULL DEFAULT NOW(),
  IMG_RSLT_DATA     JSONB,
  CONSTRAINT PK_SPIL_DATA PRIMARY KEY (SPIL_DATA_SN),
  CONSTRAINT FK_SPIL_ACDNT FOREIGN KEY (ACDNT_SN) REFERENCES ACDNT(ACDNT_SN) ON DELETE CASCADE
);

CREATE INDEX IF NOT EXISTS IDX_SPIL_ACDNT ON SPIL_DATA(ACDNT_SN);

-- 3. 예측실행 (PRED_EXEC)
CREATE TABLE IF NOT EXISTS PRED_EXEC (
  PRED_EXEC_SN    SERIAL        NOT NULL,
  SPIL_DATA_SN    INTEGER,
  ACDNT_SN        INTEGER       NOT NULL,  
  ALGO_CD         VARCHAR(20)   NOT NULL,
  EXEC_STTS_CD    VARCHAR(20)   NOT NULL DEFAULT 'PENDING',
  BGNG_DTM        TIMESTAMPTZ,
  CMPL_DTM        TIMESTAMPTZ,
  REQD_SEC        INTEGER,
  RSLT_DATA       JSONB,
  ERR_MSG         TEXT,  
  EXEC_NM         VARCHAR(100),
  CONSTRAINT PK_PRED_EXEC PRIMARY KEY (PRED_EXEC_SN),
  CONSTRAINT FK_PRED_ACDNT FOREIGN KEY (ACDNT_SN) REFERENCES ACDNT(ACDNT_SN) ON DELETE CASCADE,
  CONSTRAINT CK_PRED_STTS CHECK (EXEC_STTS_CD IN ('PENDING','RUNNING','COMPLETED','FAILED'))
);

CREATE INDEX IF NOT EXISTS IDX_PRED_ACDNT ON PRED_EXEC(ACDNT_SN);
CREATE UNIQUE INDEX IF NOT EXISTS uix_pred_exec_nm ON PRED_EXEC (EXEC_NM) WHERE EXEC_NM IS NOT NULL;

-- 4. 사고별 기상정보 스냅샷 (ACDNT_WEATHER)
CREATE TABLE IF NOT EXISTS ACDNT_WEATHER (
  WEATHER_SN      SERIAL PRIMARY KEY,
  ACDNT_SN        INTEGER NOT NULL REFERENCES ACDNT(ACDNT_SN) ON DELETE CASCADE,
  LOC_NM          VARCHAR(100),
  OBS_DTM         TIMESTAMPTZ,
  ICON            VARCHAR(10),
  TEMP            VARCHAR(20),
  WEATHER_DC      VARCHAR(50),
  WIND            VARCHAR(30),
  WAVE            VARCHAR(20),
  HUMID           VARCHAR(20),
  VIS             VARCHAR(20),
  SST             VARCHAR(20),
  TIDE            VARCHAR(30),
  HIGH_TIDE       VARCHAR(30),
  LOW_TIDE        VARCHAR(30),
  FORECAST        JSONB,
  IMPACT_DC       TEXT,
  REG_DTM         TIMESTAMPTZ DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS IDX_WEATHER_ACDNT ON ACDNT_WEATHER(ACDNT_SN);

-- 5. 사고별 미디어 메타데이터 (ACDNT_MEDIA)
CREATE TABLE IF NOT EXISTS ACDNT_MEDIA (
  MEDIA_SN        SERIAL PRIMARY KEY,
  ACDNT_SN        INTEGER NOT NULL REFERENCES ACDNT(ACDNT_SN) ON DELETE CASCADE,
  PHOTO_CNT       SMALLINT DEFAULT 0,
  VIDEO_CNT       SMALLINT DEFAULT 0,
  SAT_CNT         SMALLINT DEFAULT 0,
  CCTV_CNT        SMALLINT DEFAULT 0,
  PHOTO_META      JSONB,
  DRONE_META      JSONB,
  SAT_META        JSONB,
  CCTV_META       JSONB,
  REG_DTM         TIMESTAMPTZ DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS IDX_MEDIA_ACDNT ON ACDNT_MEDIA(ACDNT_SN);

-- ============================================================
-- 초기 데이터: IncidentsView mockIncidents (6건)
-- ============================================================
INSERT INTO ACDNT (ACDNT_CD, ACDNT_NM, ACDNT_TP_CD, ACDNT_STTS_CD, LAT, LNG, LOC_DC, OCCRN_DTM, REGION_NM, OFFICE_NM, SVRT_CD, VESSEL_TP, PHASE_CD, ANALYST_NM)
VALUES
  ('INC-2026-0001', '여수항 유류유출', '충돌/좌초', 'ACTIVE', 34.74, 127.68, '여수항 인근 해역', '2026-02-18 15:01+09', '남해청', '여수서', 'DANGER', '유조선', 'RESPONSE', '남해청, 방재과'),
  ('INC-2026-0002', '군산항 인근 오염', '원인미상', 'INVESTIGATING', 35.97, 126.72, '군산항 인근 해역', '2026-02-18 13:01+09', '서해청', '군산서', 'CAUTION', NULL, 'RESPONSE', '서해청, 군산지'),
  ('INC-2026-0003', '통영 해역 기름오염', '화물/하역', 'ACTIVE', 34.85, 128.43, '통영 해역', '2026-02-18 13:31+09', '남해청', '통영서', 'ALERT', '화물선', 'RESPONSE', '남해청, 통영지'),
  ('INC-2026-0004', '동해항 유출사고', '충돌/좌초', 'CLOSED', 37.49, 129.11, '동해항', '2026-02-15 13:30+09', '동해청', '동해서', 'INTEREST', '유조선', 'CLOSED', '동해청, 포항지'),
  ('INC-2026-0005', '사곡해수욕장 해양오염', '원인미상', 'INVESTIGATING', 34.32, 126.76, '사곡해수욕장', '2026-02-12 09:20+09', '남해청', '완도서', 'CAUTION', NULL, 'STANDBY', '남해청, 완도지'),
  ('INC-2026-0006', '제주항 부두 유출', '항만/배관', 'CLOSED', 33.51, 126.53, '제주항 부두', '2026-02-10 11:00+09', '제주청', '제주서', 'INTEREST', NULL, 'CLOSED', '제주청, 제주지');

-- IncidentTable mock 추가 (중복 안 되는 4건만)
INSERT INTO ACDNT (ACDNT_CD, ACDNT_NM, ACDNT_TP_CD, ACDNT_STTS_CD, LAT, LNG, LOC_DC, OCCRN_DTM, REGION_NM, OFFICE_NM, SVRT_CD, VESSEL_TP, PHASE_CD, ANALYST_NM)
VALUES
  ('INC-2025-0004', '인천항 기름선 파손', '충돌/좌초', 'ACTIVE', 37.45, 126.60, '인천항', '2025-02-05 11:40+09', '중부청', '인천서', 'ALERT', '유조선', 'RESPONSE', '중부청, 인천지'),
  ('INC-2025-0006', '포항 영일만 탱커', '충돌/좌초', 'ACTIVE', 36.02, 129.38, '포항 영일만', '2025-01-25 16:00+09', '동해청', '포항서', 'DANGER', '유조선', 'RESPONSE', '동해청, 포항지'),
  ('INC-2025-0007', '목포 벙커링 유출', '화물/하역', 'ACTIVE', 34.79, 126.38, '목포항', '2025-01-20 13:10+09', '서해청', '목포서', 'CAUTION', '예인선', 'RESPONSE', '서해청, 목포지'),
  ('INC-2025-0008', '부산 감천항 충돌', '충돌/좌초', 'ACTIVE', 35.08, 129.01, '부산 감천항', '2025-01-15 22:10+09', '남해청', '부산서', 'CAUTION', '화물선', 'RESPONSE', '남해청, 부산지'),
  ('INC-2025-0009', '태안 해역 유출', '충돌/좌초', 'CLOSED', 36.77, 126.13, '태안 해역', '2025-01-12 04:45+09', '중부청', '태안서', 'DANGER', '유조선', 'RESPONSE', '중부청, 태안지'),
  ('INC-2025-0010', '울산항 윤활유 유출', '화물/하역', 'CLOSED', 35.50, 129.39, '울산항', '2025-01-08 10:30+09', '남해청', '울산서', 'INTEREST', '화물선', 'STANDBY', '남해청, 울산지');

-- ============================================================
-- 유출정보 (IncidentTable 기준)
-- ============================================================
INSERT INTO SPIL_DATA (ACDNT_SN, OIL_TP_CD, SPIL_QTY, SPIL_UNIT_CD, FCST_HR) VALUES
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0001'), 'BUNKER_C', 350.0, 'KL', 72),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0002'), 'UNKNOWN', NULL, 'KL', NULL),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0003'), 'DIESEL', 120.0, 'KL', 48),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0004'), 'HEAVY_FUEL_OIL', NULL, 'KL', 72),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0005'), 'UNKNOWN', NULL, 'KL', NULL),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0006'), 'DIESEL', NULL, 'KL', NULL),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0004'), 'BUNKER_C', 85.0, 'KL', 48),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0006'), 'CRUDE_OIL', 220.0, 'KL', 72),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0007'), 'BUNKER_C', 95.0, 'KL', 48),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0008'), 'BUNKER_C', 28.0, 'KL', 12),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0009'), 'CRUDE_OIL', 1200.0, 'KL', 72),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0010'), 'LUBE_OIL', 12.5, 'KL', 24);

-- ============================================================
-- 예측실행 (IncidentTable 각 사고별 KOSPS/POSEIDON/OpenDrift 3건씩)
-- ============================================================
-- INC-2026-0001
INSERT INTO PRED_EXEC (ACDNT_SN, ALGO_CD, EXEC_STTS_CD, BGNG_DTM, CMPL_DTM, REQD_SEC) VALUES
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0001'), 'KOSPS', 'COMPLETED', '2026-02-18 15:10+09', '2026-02-18 15:25+09', 900),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0001'), 'POSEIDON', 'COMPLETED', '2026-02-18 15:10+09', '2026-02-18 15:30+09', 1200),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0001'), 'OPENDRIFT', 'COMPLETED', '2026-02-18 15:10+09', '2026-02-18 15:28+09', 1080);
-- INC-2026-0003
INSERT INTO PRED_EXEC (ACDNT_SN, ALGO_CD, EXEC_STTS_CD, BGNG_DTM, CMPL_DTM, REQD_SEC) VALUES
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0003'), 'KOSPS', 'COMPLETED', '2026-02-18 14:00+09', '2026-02-18 14:18+09', 1080),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0003'), 'POSEIDON', 'RUNNING', '2026-02-18 14:00+09', NULL, NULL),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0003'), 'OPENDRIFT', 'COMPLETED', '2026-02-18 14:00+09', '2026-02-18 14:20+09', 1200);
-- INC-2025-0004
INSERT INTO PRED_EXEC (ACDNT_SN, ALGO_CD, EXEC_STTS_CD, BGNG_DTM, CMPL_DTM, REQD_SEC) VALUES
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0004'), 'KOSPS', 'COMPLETED', '2025-02-05 12:00+09', '2025-02-05 12:15+09', 900),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0004'), 'POSEIDON', 'COMPLETED', '2025-02-05 12:00+09', '2025-02-05 12:20+09', 1200),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0004'), 'OPENDRIFT', 'COMPLETED', '2025-02-05 12:00+09', '2025-02-05 12:18+09', 1080);
-- INC-2025-0006
INSERT INTO PRED_EXEC (ACDNT_SN, ALGO_CD, EXEC_STTS_CD, BGNG_DTM, CMPL_DTM, REQD_SEC) VALUES
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0006'), 'KOSPS', 'COMPLETED', '2025-01-25 16:30+09', '2025-01-25 16:45+09', 900),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0006'), 'POSEIDON', 'COMPLETED', '2025-01-25 16:30+09', '2025-01-25 16:50+09', 1200),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0006'), 'OPENDRIFT', 'COMPLETED', '2025-01-25 16:30+09', '2025-01-25 16:48+09', 1080);
-- INC-2025-0009
INSERT INTO PRED_EXEC (ACDNT_SN, ALGO_CD, EXEC_STTS_CD, BGNG_DTM, CMPL_DTM, REQD_SEC) VALUES
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0009'), 'KOSPS', 'COMPLETED', '2025-01-12 05:00+09', '2025-01-12 05:15+09', 900),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0009'), 'POSEIDON', 'COMPLETED', '2025-01-12 05:00+09', '2025-01-12 05:20+09', 1200),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0009'), 'OPENDRIFT', 'COMPLETED', '2025-01-12 05:00+09', '2025-01-12 05:18+09', 1080);
-- INC-2025-0010
INSERT INTO PRED_EXEC (ACDNT_SN, ALGO_CD, EXEC_STTS_CD, BGNG_DTM, CMPL_DTM, REQD_SEC) VALUES
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0010'), 'KOSPS', 'COMPLETED', '2025-01-08 11:00+09', '2025-01-08 11:12+09', 720),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0010'), 'POSEIDON', 'FAILED', '2025-01-08 11:00+09', '2025-01-08 11:05+09', 300),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2025-0010'), 'OPENDRIFT', 'COMPLETED', '2025-01-08 11:00+09', '2025-01-08 11:15+09', 900);

-- ============================================================
-- 기상정보 (WEATHER_DATA 6건)
-- ============================================================
INSERT INTO ACDNT_WEATHER (ACDNT_SN, LOC_NM, OBS_DTM, ICON, TEMP, WEATHER_DC, WIND, WAVE, HUMID, VIS, SST, TIDE, HIGH_TIDE, LOW_TIDE, FORECAST, IMPACT_DC) VALUES
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0001'), '여수항 사고해역', '2026-02-18 15:00+09', '⛅', '7.2°C', '구름 많음', 'SW 5.2m/s', '1.5m', '68%', '10km', '12.3°C', 'NE 0.8kn', '06:24 · 1.82m', '12:51 · 0.34m', '[{"hour":"18시","icon":"🌥","temp":"6°"},{"hour":"21시","icon":"🌧","temp":"5°"},{"hour":"00시","icon":"🌧","temp":"4°"},{"hour":"03시","icon":"🌧","temp":"3°"},{"hour":"06시","icon":"⛅","temp":"4°"},{"hour":"09시","icon":"🌤","temp":"6°"},{"hour":"12시","icon":"☀","temp":"9°"}]', '풍속 5m/s 이상 — 오일붐 전개 주의 필요. 21시 이후 강우 예보 — 해안방제 일정 조정 권고.'),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0002'), '군산항 인근', '2026-02-18 13:00+09', '🌥', '4.8°C', '흐림', 'NW 6.1m/s', '2.0m', '72%', '8km', '9.5°C', 'W 0.5kn', '05:48 · 2.10m', '12:15 · 0.28m', '[{"hour":"16시","icon":"🌥","temp":"5°"},{"hour":"19시","icon":"🌧","temp":"3°"},{"hour":"22시","icon":"🌧","temp":"2°"},{"hour":"01시","icon":"🌨","temp":"0°"},{"hour":"04시","icon":"🌨","temp":"-1°"},{"hour":"07시","icon":"⛅","temp":"1°"},{"hour":"10시","icon":"🌤","temp":"5°"}]', '풍속 6m/s — 방제선 운항 주의. 야간 강설 예보 — 갑판 작업 제한 가능.'),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0003'), '통영 해역', '2026-02-18 13:30+09', '🌤', '8.5°C', '대체로 맑음', 'SE 3.8m/s', '1.0m', '62%', '15km', '13.1°C', 'E 0.6kn', '06:05 · 1.75m', '12:32 · 0.41m', '[{"hour":"16시","icon":"🌤","temp":"8°"},{"hour":"19시","icon":"🌥","temp":"6°"},{"hour":"22시","icon":"☁","temp":"5°"},{"hour":"01시","icon":"🌥","temp":"4°"},{"hour":"04시","icon":"🌥","temp":"3°"},{"hour":"07시","icon":"⛅","temp":"5°"},{"hour":"10시","icon":"☀","temp":"10°"}]', '양호한 기상 조건. 방제 작업에 적합. 파고 1.0m 이하로 해상 작업 가능.'),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0004'), '동해항', '2026-02-15 13:30+09', '🌊', '2.1°C', '강풍주의보', 'NE 9.7m/s', '3.2m', '78%', '6km', '8.2°C', 'S 1.2kn', '07:12 · 1.95m', '13:40 · 0.22m', '[{"hour":"16시","icon":"🌊","temp":"2°"},{"hour":"19시","icon":"🌊","temp":"1°"},{"hour":"22시","icon":"🌨","temp":"0°"},{"hour":"01시","icon":"🌨","temp":"-2°"},{"hour":"04시","icon":"❄","temp":"-3°"},{"hour":"07시","icon":"🌥","temp":"-1°"},{"hour":"10시","icon":"⛅","temp":"3°"}]', '풍속 9.7m/s — 해상 방제 작업 중단 권고. 파고 3m 이상 — 선박 접안 불가.'),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0005'), '사곡해수욕장', '2026-02-12 09:20+09', '☀', '9.8°C', '맑음', 'S 2.4m/s', '0.8m', '55%', '20km', '14.0°C', 'SW 0.3kn', '05:55 · 1.68m', '12:20 · 0.38m', '[{"hour":"12시","icon":"☀","temp":"12°"},{"hour":"15시","icon":"🌤","temp":"11°"},{"hour":"18시","icon":"🌥","temp":"8°"},{"hour":"21시","icon":"☁","temp":"6°"},{"hour":"00시","icon":"🌥","temp":"5°"},{"hour":"03시","icon":"🌥","temp":"4°"},{"hour":"06시","icon":"🌤","temp":"7°"}]', '기상 양호 — 해안 방제 작업 최적 조건. 파고 낮아 수거 작업 유리.'),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0006'), '제주항 부두', '2026-02-10 11:00+09', '🌧', '10.3°C', '비', 'W 7.5m/s', '2.5m', '85%', '4km', '15.2°C', 'NW 0.9kn', '06:38 · 2.05m', '13:05 · 0.30m', '[{"hour":"14시","icon":"🌧","temp":"10°"},{"hour":"17시","icon":"🌧","temp":"9°"},{"hour":"20시","icon":"🌥","temp":"8°"},{"hour":"23시","icon":"☁","temp":"7°"},{"hour":"02시","icon":"🌥","temp":"6°"},{"hour":"05시","icon":"⛅","temp":"7°"},{"hour":"08시","icon":"🌤","temp":"10°"}]', '강우 중 — 유흡착재 효율 저하. 풍속 7.5m/s — 오일붐 전개 주의 필요. 시정 4km — 선박 이동 주의.');

-- ============================================================
-- 미디어 메타데이터 (MEDIA_DATA 6건)
-- ============================================================
INSERT INTO ACDNT_MEDIA (ACDNT_SN, PHOTO_CNT, VIDEO_CNT, SAT_CNT, CCTV_CNT, PHOTO_META, DRONE_META, SAT_META, CCTV_META) VALUES
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0001'), 12, 3, 2, 4,
   '{"title":"유출 초기 해상 촬영","date":"2026-02-18 15:30","by":"방제정 촬영","stage":"초기대응 단계","thumbCount":6}',
   '{"title":"방제작업 항공촬영","device":"DJI Matrice 300","alt":"150m","duration":"08:12","stage":"방제작업 단계","videoCount":3}',
   '{"title":"Sentinel-1 SAR","sensor":"Sentinel-1 / KOMPSAT-5","date":"2026-02-18 18:00 UTC","resolution":"10m","detection":"OIL SLICK DETECTED","thumbCount":2}',
   '{"title":"여수항 방파제 #3","live":true,"ptz":"PTZ","angle":"352°","camCount":4,"location":"여수항 #1-#4"}'),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0002'), 5, 1, 1, 2,
   '{"title":"오염 현장 촬영","date":"2026-02-18 14:00","by":"해경 촬영","stage":"조사 단계","thumbCount":5}',
   '{"title":"오염범위 항공촬영","device":"DJI Mavic 3","alt":"100m","duration":"05:30","stage":"조사 단계","videoCount":1}',
   '{"title":"Sentinel-2 MSI","sensor":"Sentinel-2","date":"2026-02-18 10:30 UTC","resolution":"20m","detection":"OIL FILM DETECTED","thumbCount":1}',
   '{"title":"군산항 CCTV #1","live":true,"ptz":"PTZ","angle":"180°","camCount":2,"location":"군산항 #1-#2"}'),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0003'), 8, 2, 1, 3,
   '{"title":"기름오염 현장사진","date":"2026-02-18 14:20","by":"통영서 촬영","stage":"대응 단계","thumbCount":6}',
   '{"title":"오염확산 항공촬영","device":"DJI Matrice 300","alt":"120m","duration":"06:45","stage":"대응 단계","videoCount":2}',
   '{"title":"KOMPSAT-5 SAR","sensor":"KOMPSAT-5","date":"2026-02-18 11:00 UTC","resolution":"5m","detection":"OIL SLICK DETECTED","thumbCount":1}',
   '{"title":"통영항 CCTV #2","live":true,"ptz":"PTZ","angle":"270°","camCount":3,"location":"통영항 #1-#3"}'),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0004'), 15, 3, 2, 4,
   '{"title":"유출 현장 해상 촬영","date":"2026-02-15 14:00","by":"동해서 촬영","stage":"종료 단계","thumbCount":7}',
   '{"title":"방제완료 확인촬영","device":"DJI Matrice 300","alt":"200m","duration":"10:20","stage":"종료확인 단계","videoCount":3}',
   '{"title":"Sentinel-1 SAR","sensor":"Sentinel-1 / KOMPSAT-5","date":"2026-02-15 09:00 UTC","resolution":"10m","detection":"OIL SLICK DETECTED","thumbCount":2}',
   '{"title":"동해항 CCTV #1","live":false,"ptz":"PTZ","angle":"90°","camCount":4,"location":"동해항 #1-#4"}'),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0005'), 3, 1, 0, 1,
   '{"title":"해안 오염 촬영","date":"2026-02-12 10:00","by":"완도서 촬영","stage":"조사 단계","thumbCount":3}',
   '{"title":"해안선 항공촬영","device":"DJI Mavic 3","alt":"80m","duration":"04:15","stage":"조사 단계","videoCount":1}',
   '{"title":"위성영상 없음","sensor":"—","date":"—","resolution":"—","detection":"—","thumbCount":0}',
   '{"title":"사곡 해안 CCTV","live":true,"ptz":"Fixed","angle":"—","camCount":1,"location":"사곡해수욕장 #1"}'),
  ((SELECT ACDNT_SN FROM ACDNT WHERE ACDNT_CD='INC-2026-0006'), 6, 2, 1, 2,
   '{"title":"부두 유출 현장촬영","date":"2026-02-10 11:30","by":"제주서 촬영","stage":"종료 단계","thumbCount":6}',
   '{"title":"부두 주변 항공촬영","device":"DJI Matrice 300","alt":"100m","duration":"06:00","stage":"종료 단계","videoCount":2}',
   '{"title":"Sentinel-2 MSI","sensor":"Sentinel-2","date":"2026-02-10 09:30 UTC","resolution":"20m","detection":"OIL FILM DETECTED","thumbCount":1}',
   '{"title":"제주항 CCTV #1","live":false,"ptz":"PTZ","angle":"210°","camCount":2,"location":"제주항 #1-#2"}');
