<?php
declare(strict_types=1);

return [
    'up' => "CREATE TABLE IF NOT EXISTS `coaches` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `code` VARCHAR(30) NOT NULL,
    `full_name_ar` VARCHAR(300) NOT NULL,
    `full_name_en` VARCHAR(300) NULL,
    `national_id` VARCHAR(20) NULL,
    `phone` VARCHAR(30) NULL,
    `email` VARCHAR(200) NULL,
    `date_of_birth` DATE NULL,
    `gender` VARCHAR(10) NULL,
    `photo_path` VARCHAR(500) NULL,
    `bio_ar` TEXT NULL,
    `certifications_json` JSON NULL,
    `employment_type` VARCHAR(20) NOT NULL DEFAULT 'contract' COMMENT 'staff, contract, freelance',
    `employee_id` BIGINT UNSIGNED NULL COMMENT 'Link to HR if staff coach',
    `max_players_default` INT UNSIGNED NOT NULL DEFAULT 20,
    `hourly_rate` DECIMAL(15,2) NULL,
    `session_rate` DECIMAL(15,2) NULL,
    `monthly_rate` DECIMAL(15,2) NULL,
    `payment_model` VARCHAR(20) NOT NULL DEFAULT 'per_session' COMMENT 'per_session, per_player, monthly_fixed, hybrid',
    `is_active` TINYINT(1) NOT NULL DEFAULT 1,
    `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,
    `branch_id` BIGINT UNSIGNED NULL,
    UNIQUE KEY `uq_coaches_code` (`code`),
    INDEX `idx_coaches_nid` (`national_id`),
    INDEX `idx_coaches_active` (`is_active`, `is_archived`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS `coaches`",
];
