-- Priorities picklist table (synced from Autotask Ticket.priority field)
CREATE TABLE IF NOT EXISTS priorities (
    value INTEGER PRIMARY KEY,
    label VARCHAR(200) NOT NULL,
    is_active BOOLEAN DEFAULT true,
    sort_order INTEGER DEFAULT 0,
    synced_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Ticket Categories picklist table (synced from Autotask Ticket.ticketCategory field)
CREATE TABLE IF NOT EXISTS ticket_categories (
    value INTEGER PRIMARY KEY,
    label VARCHAR(200) NOT NULL,
    is_active BOOLEAN DEFAULT true,
    sort_order INTEGER DEFAULT 0,
    synced_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX IF NOT EXISTS idx_priorities_active ON priorities(is_active);
CREATE INDEX IF NOT EXISTS idx_ticket_categories_active ON ticket_categories(is_active);
