-- RBCL Core Schema - MySQL/MariaDB
-- Default admin password is "password" for local setup only.
-- Replace before production with:
-- php -r "echo password_hash('ChangeMeNow!2026', PASSWORD_DEFAULT), PHP_EOL;"


CREATE TABLE users (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    role ENUM('super_admin','player') NOT NULL,
    name VARCHAR(160) NOT NULL,
    email VARCHAR(190) NOT NULL UNIQUE,
    mobile VARCHAR(30) NULL,
    password_hash VARCHAR(255) NULL,
    status ENUM('pending','documents_pending','verification_pending','active','suspended','rejected') NOT NULL DEFAULT 'pending',
    last_login_at DATETIME NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_users_role_status (role, status),
    INDEX idx_users_mobile (mobile)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE states (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(120) NOT NULL UNIQUE,
    status TINYINT(1) NOT NULL DEFAULT 1,
    sort_order INT NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE cities (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    state_id INT UNSIGNED NOT NULL,
    name VARCHAR(120) NOT NULL,
    status TINYINT(1) NOT NULL DEFAULT 1,
    sort_order INT NOT NULL DEFAULT 0,
    UNIQUE KEY uq_city_state (state_id, name),
    INDEX idx_cities_state (state_id, status),
    CONSTRAINT fk_cities_state FOREIGN KEY (state_id) REFERENCES states(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE categories (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(120) NOT NULL UNIQUE,
    registration_fee DECIMAL(10,2) NOT NULL DEFAULT 0,
    status TINYINT(1) NOT NULL DEFAULT 1,
    sort_order INT NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE experience_levels (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(120) NOT NULL UNIQUE,
    status TINYINT(1) NOT NULL DEFAULT 1,
    sort_order INT NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE players (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    user_id BIGINT UNSIGNED NULL,
    registration_number VARCHAR(40) NULL UNIQUE,
    full_name VARCHAR(160) NOT NULL,
    age TINYINT UNSIGNED NOT NULL,
    mobile VARCHAR(30) NOT NULL,
    email VARCHAR(190) NOT NULL,
    category_id INT UNSIGNED NOT NULL,
    experience_id INT UNSIGNED NOT NULL,
    state_id INT UNSIGNED NOT NULL,
    city_id INT UNSIGNED NOT NULL,
    specialty VARCHAR(190) NULL,
    status ENUM('pending','documents_pending','verification_pending','active','suspended','rejected') NOT NULL DEFAULT 'pending',
    profile_completion TINYINT UNSIGNED NOT NULL DEFAULT 0,
    registered_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    activated_at DATETIME NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_players_filters (registration_number, full_name, mobile, email, status),
    INDEX idx_players_state_city (state_id, city_id),
    INDEX idx_players_category (category_id),
    CONSTRAINT fk_players_user FOREIGN KEY (user_id) REFERENCES users(id),
    CONSTRAINT fk_players_category FOREIGN KEY (category_id) REFERENCES categories(id),
    CONSTRAINT fk_players_experience FOREIGN KEY (experience_id) REFERENCES experience_levels(id),
    CONSTRAINT fk_players_state FOREIGN KEY (state_id) REFERENCES states(id),
    CONSTRAINT fk_players_city FOREIGN KEY (city_id) REFERENCES cities(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE player_documents (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    player_id BIGINT UNSIGNED NOT NULL,
    document_type ENUM('selfie','aadhaar_front','aadhaar_back') NOT NULL,
    original_name VARCHAR(255) NOT NULL,
    stored_name VARCHAR(255) NOT NULL,
    mime_type VARCHAR(100) NOT NULL,
    size_bytes INT UNSIGNED NOT NULL,
    uploaded_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    UNIQUE KEY uq_player_doc (player_id, document_type),
    CONSTRAINT fk_documents_player FOREIGN KEY (player_id) REFERENCES players(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE payments (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    player_id BIGINT UNSIGNED NOT NULL,
    payment_type ENUM('registration','match') NOT NULL,
    title VARCHAR(190) NOT NULL,
    amount DECIMAL(10,2) NOT NULL,
    provider ENUM('phonepe') NOT NULL DEFAULT 'phonepe',
    merchant_transaction_id VARCHAR(120) NOT NULL UNIQUE,
    provider_transaction_id VARCHAR(190) NULL,
    status ENUM('pending','success','failed','refunded') NOT NULL DEFAULT 'pending',
    payload_json JSON NULL,
    paid_at DATETIME NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_payments_player_status (player_id, status),
    INDEX idx_payments_type_status (payment_type, status),
    CONSTRAINT fk_payments_player FOREIGN KEY (player_id) REFERENCES players(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE password_tokens (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    user_id BIGINT UNSIGNED NOT NULL,
    token_hash CHAR(64) NOT NULL UNIQUE,
    purpose ENUM('create_password','reset_password') NOT NULL,
    expires_at DATETIME NOT NULL,
    used_at DATETIME NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_password_tokens_user (user_id, purpose, used_at),
    CONSTRAINT fk_password_tokens_user FOREIGN KEY (user_id) REFERENCES users(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE login_attempts (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    email VARCHAR(190) NOT NULL,
    ip_address VARCHAR(64) NOT NULL,
    attempted_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    success TINYINT(1) NOT NULL DEFAULT 0,
    INDEX idx_login_attempts (email, ip_address, attempted_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE match_payment_requests (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(190) NOT NULL,
    amount DECIMAL(10,2) NOT NULL,
    description TEXT NULL,
    due_date DATE NULL,
    status ENUM('draft','active','closed') NOT NULL DEFAULT 'draft',
    created_by BIGINT UNSIGNED NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT fk_match_payments_admin FOREIGN KEY (created_by) REFERENCES users(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE match_payment_assignments (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    request_id BIGINT UNSIGNED NOT NULL,
    player_id BIGINT UNSIGNED NOT NULL,
    payment_id BIGINT UNSIGNED NULL,
    status ENUM('pending','paid','waived','overdue') NOT NULL DEFAULT 'pending',
    assigned_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    UNIQUE KEY uq_match_payment_assignment (request_id, player_id),
    CONSTRAINT fk_assignments_request FOREIGN KEY (request_id) REFERENCES match_payment_requests(id),
    CONSTRAINT fk_assignments_player FOREIGN KEY (player_id) REFERENCES players(id),
    CONSTRAINT fk_assignments_payment FOREIGN KEY (payment_id) REFERENCES payments(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE matches (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    match_name VARCHAR(190) NOT NULL,
    match_number VARCHAR(80) NOT NULL UNIQUE,
    team_a VARCHAR(120) NOT NULL,
    team_b VARCHAR(120) NOT NULL,
    venue VARCHAR(190) NOT NULL,
    match_date DATE NOT NULL,
    match_time TIME NOT NULL,
    status ENUM('upcoming','draft','published','completed','cancelled') NOT NULL DEFAULT 'draft',
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_matches_date_status (match_date, status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE match_player_stats (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    match_id BIGINT UNSIGNED NOT NULL,
    player_id BIGINT UNSIGNED NOT NULL,
    balls_played SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    runs_scored SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    fours SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    sixes SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    overs_bowled DECIMAL(4,1) NOT NULL DEFAULT 0,
    runs_conceded SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    wickets SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    no_balls SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    wides SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    player_of_match TINYINT(1) NOT NULL DEFAULT 0,
    UNIQUE KEY uq_match_player (match_id, player_id),
    INDEX idx_stats_player (player_id),
    CONSTRAINT fk_stats_match FOREIGN KEY (match_id) REFERENCES matches(id),
    CONSTRAINT fk_stats_player FOREIGN KEY (player_id) REFERENCES players(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE match_results (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    match_id BIGINT UNSIGNED NOT NULL UNIQUE,
    winner VARCHAR(120) NULL,
    winning_margin VARCHAR(120) NULL,
    player_of_match_id BIGINT UNSIGNED NULL,
    status ENUM('draft','published') NOT NULL DEFAULT 'draft',
    published_at DATETIME NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    CONSTRAINT fk_results_match FOREIGN KEY (match_id) REFERENCES matches(id),
    CONSTRAINT fk_results_player FOREIGN KEY (player_of_match_id) REFERENCES players(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE player_career_statistics (
    player_id BIGINT UNSIGNED PRIMARY KEY,
    matches_played INT UNSIGNED NOT NULL DEFAULT 0,
    runs INT UNSIGNED NOT NULL DEFAULT 0,
    balls_faced INT UNSIGNED NOT NULL DEFAULT 0,
    fours INT UNSIGNED NOT NULL DEFAULT 0,
    sixes INT UNSIGNED NOT NULL DEFAULT 0,
    overs_bowled DECIMAL(8,1) NOT NULL DEFAULT 0,
    wickets INT UNSIGNED NOT NULL DEFAULT 0,
    runs_conceded INT UNSIGNED NOT NULL DEFAULT 0,
    player_of_match_awards INT UNSIGNED NOT NULL DEFAULT 0,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    CONSTRAINT fk_career_player FOREIGN KEY (player_id) REFERENCES players(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE menus (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(120) NOT NULL,
    parent_id BIGINT UNSIGNED NULL,
    url VARCHAR(255) NOT NULL,
    sort_order INT NOT NULL DEFAULT 0,
    active TINYINT(1) NOT NULL DEFAULT 1,
    CONSTRAINT fk_menus_parent FOREIGN KEY (parent_id) REFERENCES menus(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE pages (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(190) NOT NULL,
    slug VARCHAR(190) NOT NULL UNIQUE,
    banner VARCHAR(255) NULL,
    content MEDIUMTEXT NOT NULL,
    seo_title VARCHAR(190) NULL,
    seo_description VARCHAR(255) NULL,
    seo_keywords VARCHAR(255) NULL,
    status ENUM('draft','published') NOT NULL DEFAULT 'draft',
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    FULLTEXT KEY ft_pages (title, content, seo_keywords)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE homepage_blocks (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    block_key VARCHAR(80) NOT NULL UNIQUE,
    title VARCHAR(190) NOT NULL,
    subtitle VARCHAR(255) NULL,
    content MEDIUMTEXT NULL,
    data_json JSON NULL,
    sort_order INT NOT NULL DEFAULT 0,
    enabled TINYINT(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE gallery_categories (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(120) NOT NULL UNIQUE,
    status TINYINT(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE gallery (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    category_id INT UNSIGNED NULL,
    title VARCHAR(190) NOT NULL,
    image_path VARCHAR(255) NOT NULL,
    status TINYINT(1) NOT NULL DEFAULT 1,
    sort_order INT NOT NULL DEFAULT 0,
    CONSTRAINT fk_gallery_category FOREIGN KEY (category_id) REFERENCES gallery_categories(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE sponsors (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(190) NOT NULL,
    logo_path VARCHAR(255) NULL,
    website_url VARCHAR(255) NULL,
    status TINYINT(1) NOT NULL DEFAULT 1,
    sort_order INT NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE testimonials (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(160) NOT NULL,
    designation VARCHAR(160) NULL,
    message TEXT NOT NULL,
    image_path VARCHAR(255) NULL,
    status TINYINT(1) NOT NULL DEFAULT 1,
    sort_order INT NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE faqs (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    question VARCHAR(255) NOT NULL,
    answer TEXT NOT NULL,
    status TINYINT(1) NOT NULL DEFAULT 1,
    sort_order INT NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE settings (
    setting_key VARCHAR(120) PRIMARY KEY,
    setting_value TEXT NULL,
    setting_group VARCHAR(80) NOT NULL DEFAULT 'general'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE audit_logs (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    actor_user_id BIGINT UNSIGNED NULL,
    actor_type ENUM('admin','player','system') NOT NULL DEFAULT 'system',
    log_type VARCHAR(80) NOT NULL,
    action VARCHAR(120) NOT NULL,
    entity_type VARCHAR(120) NULL,
    entity_id BIGINT UNSIGNED NULL,
    ip_address VARCHAR(64) NULL,
    user_agent VARCHAR(255) NULL,
    metadata_json JSON NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_audit_type_date (log_type, created_at),
    INDEX idx_audit_entity (entity_type, entity_id),
    CONSTRAINT fk_audit_actor FOREIGN KEY (actor_user_id) REFERENCES users(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;


INSERT INTO users (role, name, email, mobile, password_hash, status)
VALUES ('super_admin', 'RBCL Super Admin', 'admin@myrbcl.com', '09243619991', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2uheWG/igi', 'active');

INSERT INTO categories (name, registration_fee, sort_order) VALUES
('Batsman', 499, 1), ('Bowler', 499, 2), ('Wicketkeeper Batsman', 599, 3), ('All Rounder', 699, 4);

INSERT INTO experience_levels (name, sort_order) VALUES
('Beginner', 1), ('School Level', 2), ('District Level', 3), ('State Level', 4), ('National Level', 5);

INSERT INTO states (name, sort_order) VALUES
('Chhattisgarh', 1), ('Maharashtra', 2), ('Delhi', 3), ('Uttar Pradesh', 4), ('Rajasthan', 5), ('Gujarat', 6), ('Punjab', 7), ('Haryana', 8), ('Karnataka', 9), ('Tamil Nadu', 10), ('Telangana', 11), ('West Bengal', 12);

INSERT INTO cities (state_id, name, sort_order)
SELECT id, 'Raipur', 1 FROM states WHERE name='Chhattisgarh'
UNION ALL SELECT id, 'Mumbai', 1 FROM states WHERE name='Maharashtra'
UNION ALL SELECT id, 'New Delhi', 1 FROM states WHERE name='Delhi'
UNION ALL SELECT id, 'Lucknow', 1 FROM states WHERE name='Uttar Pradesh'
UNION ALL SELECT id, 'Jaipur', 1 FROM states WHERE name='Rajasthan'
UNION ALL SELECT id, 'Ahmedabad', 1 FROM states WHERE name='Gujarat'
UNION ALL SELECT id, 'Chandigarh', 1 FROM states WHERE name='Punjab'
UNION ALL SELECT id, 'Gurugram', 1 FROM states WHERE name='Haryana'
UNION ALL SELECT id, 'Bengaluru', 1 FROM states WHERE name='Karnataka'
UNION ALL SELECT id, 'Chennai', 1 FROM states WHERE name='Tamil Nadu'
UNION ALL SELECT id, 'Hyderabad', 1 FROM states WHERE name='Telangana'
UNION ALL SELECT id, 'Kolkata', 1 FROM states WHERE name='West Bengal';

INSERT INTO menus (name, url, sort_order) VALUES
('Home', '/', 1), ('About RBCL', '/page/what-is-rbcl', 2), ('Selection Process', '/page/selection-process', 3), ('Register', '/register', 4), ('FAQs', '/page/faqs', 5), ('Contact', '/page/contact', 6);

INSERT INTO pages (title, slug, content, seo_title, seo_description, seo_keywords, status) VALUES
('What is RBCL', 'what-is-rbcl', '<h2>What is RBCL?</h2><p>Rising Bharat Cricket League, managed by Shivay Sports Management Pvt Ltd, is built to strengthen grassroots cricket and convert unprofessional players into professional opportunities across India.</p><p>The core vision of RBCL is to use cricket as a universal tool for empowering youth and creating a transparent pathway for talented cricketers.</p>', 'What is RBCL', 'Rising Bharat Cricket League overview, mission and vision.', 'RBCL, cricket trials, cricket league India', 'published'),
('Selection Process', 'selection-process', '<h2>RBCL Selection Process</h2><p>RBCL conducts professional cricket trials across India under qualified coaches and league management. Players undergo 15 to 18 ball gameplay tests, fitness evaluation, and fielding drills.</p><p>Shortlisting is performance based. Selected players are informed through email and official channels before league participation.</p>', 'RBCL Selection Process', 'Cricket trial registration and player selection process.', 'cricket selection, talent hunt, RBCL trials', 'published'),
('FAQs', 'faqs', '<h2>Frequently Asked Questions</h2><p>RBCL is managed by Shivay Sports Management Private Limited and provides a structured cricket development pathway for players across India.</p>', 'RBCL FAQs', 'Common questions about RBCL.', 'RBCL FAQ, cricket registration', 'published'),
('Contact', 'contact', '<h2>Contact RBCL</h2><p>Company Name - Shivay Sports Management Private Limited<br>Building No./Flat No.: 504, Usha Pride Road/Street: Mowa, New Raipur, Chhattisgarh.</p><p>Phone: 09243619991<br>Email: info@myrbcl.com</p>', 'Contact RBCL', 'Contact Rising Bharat Cricket League.', 'RBCL contact, Shivay Sports Management', 'published'),
('Privacy Policy', 'privacy-policy', '<h2>Privacy Policy</h2><p>RBCL protects player registration, payment, Aadhaar, and uploaded document information using controlled access and secure storage practices.</p>', 'RBCL Privacy Policy', 'Privacy policy for RBCL.', 'RBCL privacy', 'published'),
('Terms and Conditions', 'terms-and-conditions', '<h2>Terms and Conditions</h2><p>Registration and league fees are non-refundable unless otherwise stated by RBCL management. Players must provide accurate information and follow event instructions.</p>', 'RBCL Terms', 'Terms and conditions for RBCL.', 'RBCL terms', 'published');

INSERT INTO homepage_blocks (block_key, title, subtitle, content, data_json, sort_order, enabled) VALUES
('hero', 'Rising Bharat Cricket League', 'Opportunity for Talent. Recognition for Hard Work.', 'Professional cricket trials, league matches, transparent selection, and player development across India.', JSON_OBJECT('cta','Register Now','phone','09243619991'), 1, 1),
('about', 'About RBCL', 'Grassroots cricket, built professionally.', 'RBCL identifies potential players through transparent cricket trials and provides opportunities in competitive league matches under qualified coaches and selectors.', NULL, 2, 1),
('statistics', 'League Pulse', 'Live operational metrics for registrations, players, payments, and matches.', NULL, NULL, 3, 1),
('registration_cta', 'Start Your RBCL Journey', 'Choose your category, pay securely, and receive your registration number by email.', NULL, NULL, 4, 1),
('services', 'RBCL Benefits', 'Trials, selection, professional supervision, league exposure, and performance-based rewards.', 'Players are evaluated through skill, fitness, fielding, and match performance with transparent selection criteria.', NULL, 5, 1),
('selection_process', 'Selection Process', 'Registration, trials, shortlisting, league participation, and rewards.', NULL, NULL, 6, 1),
('upcoming_matches', 'Upcoming Matches', 'Published fixtures appear here automatically.', NULL, NULL, 7, 1),
('latest_results', 'Latest Results', 'Only published results are visible on the public site.', NULL, NULL, 8, 1),
('top_players', 'Top Players', 'Career statistics drive rankings automatically.', NULL, NULL, 9, 1),
('gallery', 'Gallery', 'Moments from RBCL trials and league events.', NULL, NULL, 10, 1),
('sponsors', 'Sponsors', 'Partners supporting the next generation of cricket talent.', NULL, NULL, 11, 1),
('testimonials', 'Testimonials', 'Stories from players and supporters.', NULL, NULL, 12, 1),
('faq', 'FAQ', 'Answers to common registration, selection, and payment questions.', NULL, NULL, 13, 1),
('contact', 'Contact', 'Reach RBCL for trials, league information, and player support.', NULL, NULL, 14, 1);

INSERT INTO gallery_categories (name) VALUES ('Trials'), ('League Matches'), ('Awards');
INSERT INTO sponsors (name, website_url, sort_order) VALUES ('RBCL Partner Network', 'https://www.myrbcl.com', 1);
INSERT INTO testimonials (name, designation, message, sort_order) VALUES ('RBCL Player', 'Registered Cricketer', 'The RBCL pathway gave me a professional trial experience and clear next steps.', 1);
INSERT INTO faqs (question, answer, sort_order) VALUES
('Who can register for RBCL?', 'Players in eligible age groups and categories can register through the official RBCL platform.', 1),
('Is the registration fee refundable?', 'Registration fees are non-refundable unless RBCL management officially announces otherwise.', 2),
('How will selected players be informed?', 'Selected players are informed through email and official RBCL communication channels.', 3);

INSERT INTO settings (setting_key, setting_value, setting_group) VALUES
('site_phone', '09243619991', 'contact'),
('site_email', 'info@myrbcl.com', 'contact'),
('site_address', '504, Usha Pride, Mowa, New Raipur, Chhattisgarh', 'contact'),
('registration_number_prefix', 'RBCL', 'registration');
