<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE `sa_player_documents` (
            `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `player_id` BIGINT UNSIGNED NOT NULL,
            `document_type` VARCHAR(30) NOT NULL COMMENT 'medical_cert, birth_cert, photo, national_id, other',
            `file_path` VARCHAR(500) NOT NULL,
            `file_name` VARCHAR(255) NOT NULL,
            `exam_date` DATE NULL,
            `expiry_date` DATE NULL,
            `doctor_name` VARCHAR(200) NULL,
            `clinic_name` VARCHAR(200) NULL,
            `approval_status` VARCHAR(20) NOT NULL DEFAULT 'pending' COMMENT 'pending, approved, rejected, expired',
            `approved_by` BIGINT UNSIGNED NULL,
            `approved_at` TIMESTAMP NULL,
            `rejection_reason` TEXT NULL,
            `notes` TEXT 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,
            INDEX `idx_sa_pd_player` (`player_id`),
            INDEX `idx_sa_pd_type` (`document_type`),
            INDEX `idx_sa_pd_approval` (`approval_status`),
            INDEX `idx_sa_pd_expiry` (`expiry_date`),
            CONSTRAINT `fk_sa_pd_player` FOREIGN KEY (`player_id`) REFERENCES `sa_players`(`id`) ON DELETE CASCADE
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `sa_player_documents`",
];
