<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE `sa_players` (
            `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `player_type` VARCHAR(20) NOT NULL COMMENT 'member, non_member',
            `member_id` BIGINT UNSIGNED NULL,
            `registration_serial` VARCHAR(50) NULL,
            `full_name_ar` VARCHAR(300) NOT NULL,
            `full_name_en` VARCHAR(300) NULL,
            `national_id` VARCHAR(20) NULL,
            `date_of_birth` DATE NULL,
            `gender` VARCHAR(10) NULL,
            `phone` VARCHAR(30) NULL,
            `email` VARCHAR(200) NULL,
            `guardian_name` VARCHAR(300) NULL,
            `guardian_phone` VARCHAR(30) NULL,
            `guardian_national_id` VARCHAR(20) NULL,
            `guardian_relationship` VARCHAR(50) NULL,
            `photo_path` VARCHAR(500) NULL,
            `medical_status` VARCHAR(30) NOT NULL DEFAULT 'pending' COMMENT 'pending, fit, conditional, unfit, expired',
            `medical_expiry_date` DATE NULL,
            `card_status` VARCHAR(20) NOT NULL DEFAULT 'inactive' COMMENT 'inactive, active, suspended, revoked',
            `registration_fee_paid` TINYINT(1) NOT NULL DEFAULT 0,
            `notes` TEXT NULL,
            `branch_id` BIGINT UNSIGNED NULL,
            `is_archived` TINYINT(1) NOT NULL DEFAULT 0,
            `archived_at` TIMESTAMP NULL,
            `archived_by` BIGINT UNSIGNED NULL,
            `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
            `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
            `created_by` BIGINT UNSIGNED NULL,
            `updated_by` BIGINT UNSIGNED NULL,
            UNIQUE KEY `uq_sa_player_serial` (`registration_serial`),
            INDEX `idx_sa_player_type` (`player_type`),
            INDEX `idx_sa_player_member` (`member_id`),
            INDEX `idx_sa_player_nid` (`national_id`),
            INDEX `idx_sa_player_medical` (`medical_status`),
            INDEX `idx_sa_player_card` (`card_status`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `sa_players`",
];
