-- 027: ACDNT_WEATHER 테이블에 구조화된 기상 수치 컬럼 추가
-- 확산예측 실행 시 WeatherRightPanel에 표시되는 모든 기상정보 저장을 위해
-- 기존 VARCHAR 컬럼(WIND, WAVE, TEMP, SST)은 하위 호환성 유지를 위해 보존

ALTER TABLE wing.ACDNT_WEATHER
  ADD COLUMN IF NOT EXISTS WIND_SPEED     NUMERIC(5,1),   -- 풍속 (m/s)
  ADD COLUMN IF NOT EXISTS WIND_DIR       INTEGER,         -- 풍향 (도)
  ADD COLUMN IF NOT EXISTS WIND_DIR_LBL   VARCHAR(10),     -- 풍향 텍스트 (N, NW, ...)
  ADD COLUMN IF NOT EXISTS WIND_SPEED_1K  NUMERIC(5,1),   -- 1k 최고 풍속 (m/s)
  ADD COLUMN IF NOT EXISTS WIND_SPEED_3K  NUMERIC(5,1),   -- 3k 평균 풍속 (m/s)
  ADD COLUMN IF NOT EXISTS PRESSURE       NUMERIC(6,1),    -- 기압 (hPa)
  ADD COLUMN IF NOT EXISTS WAVE_HEIGHT    NUMERIC(4,1),    -- 유의파고 (m)
  ADD COLUMN IF NOT EXISTS WAVE_MAX_HT    NUMERIC(4,1),    -- 최고파고 (m)
  ADD COLUMN IF NOT EXISTS WAVE_PERIOD    NUMERIC(4,1),    -- 파도 주기 (s)
  ADD COLUMN IF NOT EXISTS WAVE_DIR       VARCHAR(10),     -- 파향 (N, NE, ...)
  ADD COLUMN IF NOT EXISTS AIR_TEMP       NUMERIC(5,1),    -- 기온 (°C)
  ADD COLUMN IF NOT EXISTS SALINITY       NUMERIC(5,1),    -- 염분 (PSU)
  ADD COLUMN IF NOT EXISTS SUNRISE        VARCHAR(10),     -- 일출 시각 (HH:MM)
  ADD COLUMN IF NOT EXISTS SUNSET         VARCHAR(10),     -- 일몰 시각 (HH:MM)
  ADD COLUMN IF NOT EXISTS MOONRISE       VARCHAR(10),     -- 월출 시각 (HH:MM)
  ADD COLUMN IF NOT EXISTS MOONSET        VARCHAR(10),     -- 월몰 시각 (HH:MM)
  ADD COLUMN IF NOT EXISTS MOON_PHASE     VARCHAR(30),     -- 월상 (예: 상현달 14일)
  ADD COLUMN IF NOT EXISTS TIDAL_RANGE    NUMERIC(4,1),    -- 조차 (m)
  ADD COLUMN IF NOT EXISTS WEATHER_ALERT  TEXT;            -- 날씨 특보

COMMENT ON COLUMN wing.ACDNT_WEATHER.WIND_SPEED    IS '풍속 (m/s)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.WIND_DIR      IS '풍향 (도, 0-360)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.WIND_DIR_LBL  IS '풍향 텍스트 (N/NE/E/...)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.WIND_SPEED_1K IS '1km 최고 풍속 (m/s)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.WIND_SPEED_3K IS '3km 평균 풍속 (m/s)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.PRESSURE      IS '기압 (hPa)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.WAVE_HEIGHT   IS '유의파고 (m)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.WAVE_MAX_HT   IS '최고파고 (m)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.WAVE_PERIOD   IS '파도 주기 (s)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.WAVE_DIR      IS '파향 (N/NE/E/...)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.AIR_TEMP      IS '기온 (°C)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.SALINITY      IS '염분 (PSU)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.SUNRISE       IS '일출 시각 (HH:MM)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.SUNSET        IS '일몰 시각 (HH:MM)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.MOONRISE      IS '월출 시각 (HH:MM)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.MOONSET       IS '월몰 시각 (HH:MM)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.MOON_PHASE    IS '월상 (예: 상현달 14일)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.TIDAL_RANGE   IS '조차 (m)';
COMMENT ON COLUMN wing.ACDNT_WEATHER.WEATHER_ALERT IS '날씨 특보 문자열';
