-- 고객별 세금 신고 일정
CREATE TABLE IF NOT EXISTS tax_filings (
    id           SERIAL PRIMARY KEY,
    client_id    INT          NOT NULL REFERENCES clients(id) ON DELETE CASCADE,
    filing_type  VARCHAR(60)  NOT NULL,  -- 부가가치세, 종합소득세, 법인세, 원천징수, 종합부동산세, 기타
    due_date     DATE         NOT NULL,
    status       VARCHAR(20)  NOT NULL DEFAULT 'pending',  -- pending, filed, overdue
    memo         TEXT,
    created_at   TIMESTAMPTZ  NOT NULL DEFAULT NOW(),
    updated_at   TIMESTAMPTZ  NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_tax_filings_client   ON tax_filings (client_id);
CREATE INDEX IF NOT EXISTS idx_tax_filings_due_date ON tax_filings (due_date);
CREATE INDEX IF NOT EXISTS idx_tax_filings_status   ON tax_filings (status);
