-- 고객 카드 (Client CRM)
CREATE TABLE IF NOT EXISTS clients (
    id           SERIAL PRIMARY KEY,
    name         VARCHAR(100) NOT NULL,
    company_name VARCHAR(200),
    phone        VARCHAR(30),
    email        VARCHAR(200),
    service_type VARCHAR(50),   -- 기장, 부동산, 증여상속, 종합소득세, 기타
    tax_type     VARCHAR(30),   -- 개인사업자, 법인사업자, 면세사업자
    status       VARCHAR(20)  NOT NULL DEFAULT 'active',  -- active, inactive
    source       VARCHAR(50),   -- 홈페이지문의, 소개, 직접방문, 카카오채널, 블로그, 기타
    memo         TEXT,
    created_at   TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at   TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_clients_status    ON clients (status);
CREATE INDEX IF NOT EXISTS idx_clients_name      ON clients (name);
CREATE INDEX IF NOT EXISTS idx_clients_phone     ON clients (phone);
