CREATE TABLE games (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    name VARCHAR(255) NOT NULL,
    type VARCHAR(50) NOT NULL,
    is_active BOOLEAN DEFAULT TRUE,
    metadata JSONB DEFAULT '{}',
    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    
    CONSTRAINT chk_games_type_valid
        CHECK (type IN ('SPIN', 'RAFFLE', 'MINIGAME'))
);

-- Create indexes
CREATE INDEX idx_games_type ON games(type);
CREATE INDEX idx_games_is_active ON games(is_active);
CREATE INDEX idx_games_created_at ON games(created_at);
