<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS private_match_bookings (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    facility_id INT UNSIGNED NOT NULL,
    booked_by_member_id INT UNSIGNED NULL,
    booked_by_name VARCHAR(200) NULL,
    booked_by_phone VARCHAR(20) NULL,
    booking_date DATE NOT NULL,
    start_time TIME NOT NULL,
    end_time TIME NOT NULL,
    match_type ENUM('friendly','training','tournament','other') NOT NULL DEFAULT 'friendly',
    team_a_name VARCHAR(100) NULL,
    team_b_name VARCHAR(100) NULL,
    players_count TINYINT UNSIGNED NOT NULL DEFAULT 10,
    has_referee TINYINT(1) NOT NULL DEFAULT 0,
    referee_cost DECIMAL(10,2) NOT NULL DEFAULT 0.00,
    facility_cost DECIMAL(10,2) NOT NULL DEFAULT 0.00,
    total_cost DECIMAL(10,2) NOT NULL DEFAULT 0.00,
    deposit_paid DECIMAL(10,2) NOT NULL DEFAULT 0.00,
    status ENUM('pending','confirmed','in_progress','completed','cancelled') NOT NULL DEFAULT 'pending',
    payment_status ENUM('unpaid','partial','paid') NOT NULL DEFAULT 'unpaid',
    notes TEXT NULL,
    cancelled_reason TEXT NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_facility_date (facility_id, booking_date),
    INDEX idx_member (booked_by_member_id),
    INDEX idx_status (status),
    INDEX idx_date (booking_date)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
",
    'down' => "DROP TABLE IF EXISTS private_match_bookings",
];
