-- Tournament Turn Settings Update
-- Execute this to add turn-specific settings to existing tournament_config tables
-- This allows each tournament to have its own turn generation rates

-- Add turn-specific columns to tournament_config
ALTER TABLE tournament_config 
ADD COLUMN turn_min DECIMAL(10,2) DEFAULT 0.05 COMMENT 'Turn generation rate in seconds' AFTER server_id,
ADD COLUMN turn_max INT DEFAULT 5000 COMMENT 'Maximum turns a player can accumulate' AFTER turn_min,
ADD COLUMN turn_protection INT DEFAULT 0 COMMENT 'Newbie protection turns' AFTER turn_max;

-- Update existing tournaments to have default turn settings if they exist
UPDATE tournament_config 
SET turn_min = 0.05, turn_max = 5000, turn_protection = 0 
WHERE turn_min IS NULL;

-- Sample tournament with custom turn settings (commented out)
/*
INSERT INTO tournament_config (
    tournament_name,
    tournament_password,
    status,
    players_per_team,
    server_id,
    turn_min,
    turn_max,
    turn_protection,
    start_date,
    end_date,
    description,
    rules,
    prize_info
) VALUES (
    'Fast Paced Tournament',
    SHA2('fastpass123', 256),
    'scheduled',
    3,
    0,
    0.02,  -- Faster turn generation (0.02 seconds)
    10000, -- Higher turn cap
    100,   -- Some protection turns
    DATE_ADD(NOW(), INTERVAL 2 HOUR),
    DATE_ADD(NOW(), INTERVAL 1 DAY),
    'A fast-paced tournament with accelerated turn generation.',
    'Standard rules but with faster gameplay.',
    'Speed demon rewards!'
);
*/