-- Update task rewards and add new deposit (other) tasks.
-- requirement and reward_amount are in bigint (tickets * 1_000_000).

-- ========== FOLLOW: change 5 tickets reward to 7 tickets ==========
UPDATE `tasks` SET `reward_amount` = 7000000 WHERE `type` = 'follow' AND `reward_amount` = 5000000;

-- ========== OTHER (deposit): update existing rewards ==========
-- 2000 tickets: reward 200 -> 100
UPDATE `tasks` SET `reward_amount` = 100000000, `description` = 'Top up Balance: 2000 Tickets'
WHERE `type` = 'other' AND `requirement` = 2000000000;

-- 5000 tickets: reward 500 -> 250
UPDATE `tasks` SET `reward_amount` = 250000000, `description` = 'Top up Balance: 5000 Tickets'
WHERE `type` = 'other' AND `requirement` = 5000000000;

-- 10000 tickets: reward 1000 -> 500
UPDATE `tasks` SET `reward_amount` = 500000000, `description` = 'Top up Balance: 10000 Tickets'
WHERE `type` = 'other' AND `requirement` = 10000000000;

-- ========== OTHER: add new deposit tasks (50000, 150000, 500000 tickets) ==========
-- display_order: existing are 1..4 (50, 250, 2000, 5000, 10000 from V28/V32). Get max display_order for other type then add 5,6,7.
-- 50000 tickets -> 2500 reward; 150000 -> 7500; 500000 -> 25000
INSERT INTO `tasks` (`type`, `requirement`, `reward_amount`, `reward_type`, `display_order`, `title`, `description`)
SELECT 'other', 50000000000, 2500000000, 'Tickets', 5, 'Top up Balance', 'Top up Balance: 50000 Tickets'
WHERE NOT EXISTS (SELECT 1 FROM `tasks` WHERE `type` = 'other' AND `requirement` = 50000000000);

INSERT INTO `tasks` (`type`, `requirement`, `reward_amount`, `reward_type`, `display_order`, `title`, `description`)
SELECT 'other', 150000000000, 7500000000, 'Tickets', 6, 'Top up Balance', 'Top up Balance: 150000 Tickets'
WHERE NOT EXISTS (SELECT 1 FROM `tasks` WHERE `type` = 'other' AND `requirement` = 150000000000);

INSERT INTO `tasks` (`type`, `requirement`, `reward_amount`, `reward_type`, `display_order`, `title`, `description`)
SELECT 'other', 500000000000, 25000000000, 'Tickets', 7, 'Top up Balance', 'Top up Balance: 500000 Tickets'
WHERE NOT EXISTS (SELECT 1 FROM `tasks` WHERE `type` = 'other' AND `requirement` = 500000000000);

-- ========== REFERRAL: update rewards (requirement -> new reward in tickets) ==========
-- 1 -> 5; 3 -> 15; 7 -> 35; 15 -> 75; 30 -> 110; 50 -> 150; 100 -> 375
UPDATE `tasks` SET `reward_amount` = 5000000   WHERE `type` = 'referral' AND `requirement` = 1;
UPDATE `tasks` SET `reward_amount` = 15000000  WHERE `type` = 'referral' AND `requirement` = 3;
UPDATE `tasks` SET `reward_amount` = 35000000  WHERE `type` = 'referral' AND `requirement` = 7;
UPDATE `tasks` SET `reward_amount` = 75000000  WHERE `type` = 'referral' AND `requirement` = 15;
UPDATE `tasks` SET `reward_amount` = 110000000 WHERE `type` = 'referral' AND `requirement` = 30;
UPDATE `tasks` SET `reward_amount` = 150000000 WHERE `type` = 'referral' AND `requirement` = 50;
UPDATE `tasks` SET `reward_amount` = 375000000 WHERE `type` = 'referral' AND `requirement` = 100;
