-- Create page_element_configs table for storing visual element variant preferences
CREATE TABLE IF NOT EXISTS page_element_configs (
    id SERIAL PRIMARY KEY,
    page_type VARCHAR(50) NOT NULL,
    element_name VARCHAR(100) NOT NULL,
    variant VARCHAR(50) NOT NULL,
    visible BOOLEAN DEFAULT true,
    display_order INTEGER DEFAULT 0,
    settings JSONB,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    deleted_at TIMESTAMP,
    UNIQUE(page_type, element_name)
);

CREATE INDEX idx_page_element_configs_page_type ON page_element_configs(page_type);
CREATE INDEX idx_page_element_configs_element_name ON page_element_configs(element_name);
