create table process_item (
    id              bigserial primary key,
    org_id          bigint not null references organization (id) on delete cascade,
    seq             integer not null,
    site_name       varchar(300),
    category        varchar(500),
    board_name      varchar(300),
    post_title      varchar(1000),
    url             varchar(1000),
    description     varchar(1000),
    has_attachment  varchar(50),
    prior_kogl_type varchar(100),   -- 기존 공공누리유형(+AI)
    contract_docs   varchar(500),   -- 계약서 유무 (웹에선 체크박스 조합, 쉼표 연결 저장)
    produced_date   varchar(20),
    published_date  varchar(20),
    review_major    varchar(200),
    review_minor    varchar(300),
    review_result   varchar(200),   -- 처리 구분
    review_kogl_type varchar(50),
    review_ai_type  varchar(50),
    review_opinion  varchar(2000),
    review_note     varchar(1000),
    prior_evidence  varchar(1000),  -- 기존 증빙자료
    judged_kogl_type varchar(50),
    judged_ai_type  varchar(50),
    final_opinion   varchar(3000),
    judgment_basis  varchar(3000),  -- 판단근거
    process_status  varchar(50),    -- 처리상태 (미처리/처리완료)
    processed_at    timestamptz,    -- 처리완료로 저장된 시각
    web_edited_at   timestamptz,
    created_at      timestamptz not null default now(),
    updated_at      timestamptz not null default now(),
    constraint uq_process_item unique (org_id, seq)
);
create index ix_process_item_org on process_item (org_id, seq);
