USE aihub;

INSERT INTO unlock_rules (module_id, rule_type, threshold_value, sort_order)
SELECT m.id, 'deposit_total', 1, 1 FROM modules m WHERE m.slug = 'casino'
AND NOT EXISTS (SELECT 1 FROM unlock_rules ur WHERE ur.module_id = m.id);

INSERT INTO unlock_rules (module_id, rule_type, threshold_value, sort_order)
SELECT m.id, 'deposit_total', 10000, 1 FROM modules m WHERE m.slug = 'forex'
AND NOT EXISTS (SELECT 1 FROM unlock_rules ur WHERE ur.module_id = m.id);

-- Removed surveys unlock rule
INSERT INTO unlock_rules (module_id, rule_type, threshold_value, sort_order)
SELECT m.id, 'survey_points', 5, 1 FROM modules m WHERE m.slug = 'socialmedis'
AND NOT EXISTS (SELECT 1 FROM unlock_rules ur WHERE ur.module_id = m.id);
