-- 019_ship_insurance.sql
-- 유류오염보장계약 테이블 (해양수산부 공공데이터)

CREATE TABLE IF NOT EXISTS SHIP_INSURANCE (
  ins_sn          SERIAL PRIMARY KEY,
  ship_no         VARCHAR(30),
  nation_tp       VARCHAR(20),
  ship_tp         VARCHAR(30),
  ship_tp_detail  VARCHAR(50),
  hns_yn          VARCHAR(2),
  call_sign       VARCHAR(20),
  imo_no          VARCHAR(20),
  oper_tp         VARCHAR(20),
  ship_nm         VARCHAR(200),
  owner_nm        VARCHAR(200),
  gross_ton       VARCHAR(30),
  intl_gross_ton  VARCHAR(30),
  deadweight_ton  VARCHAR(30),
  insurer_nm      VARCHAR(200),
  liability_yn    VARCHAR(2),
  oil_pollution_yn VARCHAR(2),
  fuel_oil_yn     VARCHAR(2),
  wreck_removal_yn VARCHAR(2),
  crew_damage_yn  VARCHAR(2),
  pax_damage_yn   VARCHAR(2),
  hull_damage_yn  VARCHAR(2),
  dock_damage_yn  VARCHAR(2),
  valid_start     DATE,
  valid_end       DATE,
  issue_country   VARCHAR(50),
  issue_org       VARCHAR(100),
  reg_dtm         TIMESTAMP,
  mod_dtm         TIMESTAMP,
  created_at      TIMESTAMP DEFAULT NOW()
);

CREATE INDEX idx_ship_ins_ship_nm ON SHIP_INSURANCE(ship_nm);
CREATE INDEX idx_ship_ins_imo ON SHIP_INSURANCE(imo_no);
CREATE INDEX idx_ship_ins_call_sign ON SHIP_INSURANCE(call_sign);
CREATE INDEX idx_ship_ins_insurer ON SHIP_INSURANCE(insurer_nm);
CREATE INDEX idx_ship_ins_issue_org ON SHIP_INSURANCE(issue_org);
CREATE INDEX idx_ship_ins_ship_tp ON SHIP_INSURANCE(ship_tp);
