
UPDATE categories SET registration_fee = 799 WHERE name IN ('Batsman', 'Bowler', 'Wicketkeeper Batsman', 'All Rounder');

INSERT INTO gallery_categories (id, name, status) VALUES
(1, 'Trials', 1), (2, 'League Matches', 1), (3, 'Awards', 1)
ON DUPLICATE KEY UPDATE name = VALUES(name), status = VALUES(status);

INSERT INTO gallery (category_id, title, image_path, status, sort_order) VALUES
(1, 'Batting Trial', 'https://images.pexels.com/photos/35887607/pexels-photo-35887607.jpeg?auto=compress&cs=tinysrgb&w=1200', 1, 1),
(1, 'Bowling Action', 'https://images.pexels.com/photos/18084233/pexels-photo-18084233.jpeg?auto=compress&cs=tinysrgb&w=1200', 1, 2),
(1, 'Bat and Ball', 'https://images.unsplash.com/photo-1531415074968-036ba1b575da?auto=format&fit=crop&w=1200&q=80', 1, 3),
(2, 'Ground View', 'https://images.unsplash.com/photo-1624526267942-ab0ff8a3e972?auto=format&fit=crop&w=1200&q=80', 1, 4),
(2, 'Trial Highlights', 'https://images.pexels.com/photos/35887607/pexels-photo-35887607.jpeg?auto=compress&cs=tinysrgb&w=1200', 1, 5),
(2, 'Player Interviews', 'https://images.pexels.com/photos/18084233/pexels-photo-18084233.jpeg?auto=compress&cs=tinysrgb&w=1200', 1, 6);

INSERT INTO sponsors (name, logo_path, website_url, status, sort_order) VALUES
('Bharat Sports', NULL, '#', 1, 1),
('Royal Kit', NULL, '#', 1, 2),
('Blue Strike', NULL, '#', 1, 3),
('Victory Media', NULL, '#', 1, 4);

INSERT INTO testimonials (name, designation, message, image_path, status, sort_order) VALUES
('Aarav Singh', 'Opening Batsman', 'RBCL gave me a professional trial environment with clear evaluation and communication.', NULL, 1, 1),
('Kabir Khan', 'Fast Bowler', 'The process felt structured from registration to trial day reporting.', NULL, 1, 2),
('Rohan Verma', 'All Rounder', 'The dashboard, payment flow, and selection updates made the experience simple.', NULL, 1, 3);

INSERT INTO matches (match_name, match_number, team_a, team_b, venue, match_date, match_time, status) VALUES
('RBCL Trial League Opener', 'RBCL-M001', 'Delhi Titans', 'Mumbai Royals', 'Raipur Cricket Ground', DATE_ADD(CURDATE(), INTERVAL 7 DAY), '09:30:00', 'upcoming'),
('North Zone Qualifier', 'RBCL-M002', 'Punjab Warriors', 'Bengal Strikers', 'Delhi Sports Complex', DATE_ADD(CURDATE(), INTERVAL 14 DAY), '14:00:00', 'published'),
('West Zone Showcase', 'RBCL-M003', 'Gujarat Bulls', 'Deccan Kings', 'Ahmedabad Cricket Arena', DATE_SUB(CURDATE(), INTERVAL 5 DAY), '10:00:00', 'completed')
ON DUPLICATE KEY UPDATE match_name = VALUES(match_name), venue = VALUES(venue), status = VALUES(status);

INSERT INTO players (registration_number, full_name, age, mobile, email, category_id, experience_id, state_id, city_id, specialty, status, profile_completion)
VALUES
('RBCL3005202612345', 'Aarav Singh', 19, '9000000001', 'aarav.demo@rbcl.in', 1, 3, 3, 3, 'Opening Batsman', 'active', 100),
('RBCL3005202623456', 'Kabir Khan', 21, '9000000002', 'kabir.demo@rbcl.in', 2, 4, 2, 2, 'Fast Bowler', 'active', 90),
('RBCL3005202634567', 'Rohan Verma', 18, '9000000003', 'rohan.demo@rbcl.in', 4, 3, 4, 4, 'All Rounder', 'active', 80),
('RBCL3005202645678', 'Dev Patel', 17, '9000000004', 'dev.demo@rbcl.in', 3, 2, 1, 1, 'Wicketkeeper Batsman', 'verification_pending', 70)
ON DUPLICATE KEY UPDATE full_name = VALUES(full_name), status = VALUES(status), profile_completion = VALUES(profile_completion);

INSERT IGNORE INTO player_career_statistics (player_id, matches_played, runs, balls_faced, fours, sixes, overs_bowled, wickets, runs_conceded, player_of_match_awards)
SELECT id, 6, 242, 178, 28, 11, 2.0, 1, 18, 2 FROM players WHERE registration_number = 'RBCL3005202612345';
INSERT IGNORE INTO player_career_statistics (player_id, matches_played, runs, balls_faced, fours, sixes, overs_bowled, wickets, runs_conceded, player_of_match_awards)
SELECT id, 5, 76, 62, 8, 2, 18.0, 12, 118, 1 FROM players WHERE registration_number = 'RBCL3005202623456';
INSERT IGNORE INTO player_career_statistics (player_id, matches_played, runs, balls_faced, fours, sixes, overs_bowled, wickets, runs_conceded, player_of_match_awards)
SELECT id, 7, 188, 151, 19, 7, 15.0, 8, 103, 1 FROM players WHERE registration_number = 'RBCL3005202634567';
INSERT IGNORE INTO player_career_statistics (player_id, matches_played, runs, balls_faced, fours, sixes, overs_bowled, wickets, runs_conceded, player_of_match_awards)
SELECT id, 3, 92, 78, 10, 3, 0.0, 0, 0, 0 FROM players WHERE registration_number = 'RBCL3005202645678';

INSERT INTO payments (player_id, payment_type, title, amount, merchant_transaction_id, status, paid_at)
SELECT id, 'registration', 'RBCL Registration Fee', 799, CONCAT('DEMO-PAY-', id), 'success', NOW() FROM players
WHERE registration_number IN ('RBCL3005202612345','RBCL3005202623456','RBCL3005202634567','RBCL3005202645678')
ON DUPLICATE KEY UPDATE status = 'success', paid_at = NOW();

INSERT INTO match_results (match_id, winner, winning_margin, player_of_match_id, status, published_at)
SELECT m.id, 'Gujarat Bulls', 'Won by 22 runs', p.id, 'published', NOW()
FROM matches m JOIN players p ON p.registration_number = 'RBCL3005202634567'
WHERE m.match_number = 'RBCL-M003'
ON DUPLICATE KEY UPDATE winner = VALUES(winner), winning_margin = VALUES(winning_margin), status = 'published', published_at = NOW();

INSERT INTO match_payment_requests (category_id, title, amount, description, due_date, status)
SELECT id, 'Quarter Final Match Fee', 999, 'Category-wise match participation fee for shortlisted RBCL players.', DATE_ADD(CURDATE(), INTERVAL 10 DAY), 'active'
FROM categories WHERE name = 'Batsman'
LIMIT 1;
INSERT INTO match_payment_requests (category_id, title, amount, description, due_date, status)
SELECT id, 'Camp Participation Fee', 799, 'Training camp fee visible only to this category.', DATE_ADD(CURDATE(), INTERVAL 15 DAY), 'active'
FROM categories WHERE name = 'Bowler'
LIMIT 1;

INSERT INTO faqs (question, answer, status, sort_order) VALUES
('How do I register for RBCL trials?', 'Fill the official registration form, pay the category fee, and keep your registration number for future communication.', 1, 4),
('Will I get a player dashboard?', 'Yes. After successful payment and password creation, each player gets a mobile-first dashboard.', 1, 5),
('How are players selected?', 'Selection is based on trial performance, batting, bowling, fielding, fitness, and match awareness.', 1, 6);
