-- Migration: Wheel of Mischief
-- Tables: wheel_of_mischief_cards, wheel_of_mischief_custom_segments

CREATE TABLE IF NOT EXISTS wheel_of_mischief_cards (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    code VARCHAR(64) NOT NULL UNIQUE,
    segment_type VARCHAR(32) NOT NULL, -- dare, truth, tiny_forfeit, dance_break, kiss_emoji_story, mystery_box, partner_decides, compliment_storm, cool_down, swap, double_points, free_pass
    title VARCHAR(128) NOT NULL,
    prompt_text TEXT NOT NULL,
    apart_prompt TEXT NOT NULL,
    together_prompt TEXT NOT NULL,
    level INT NOT NULL DEFAULT 1, -- 1: Mild, 2: Spicy, 3: Wild
    mode ENUM('together','apart','both') NOT NULL DEFAULT 'both',
    is_spicy TINYINT(1) NOT NULL DEFAULT 0,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_wom_segment_level (segment_type, level, is_spicy),
    INDEX idx_wom_mode (mode)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS wheel_of_mischief_custom_segments (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    couple_id BIGINT UNSIGNED NOT NULL,
    created_by_user_id BIGINT UNSIGNED NOT NULL,
    title VARCHAR(64) NOT NULL,
    prompt_text TEXT NOT NULL,
    icon VARCHAR(16) NOT NULL DEFAULT '✨',
    segment_type VARCHAR(32) NOT NULL DEFAULT 'custom',
    suggested_weight DECIMAL(4,2) NOT NULL DEFAULT 1.00,
    is_active TINYINT(1) NOT NULL DEFAULT 1,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_wom_couple (couple_id, is_active)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
