<?php
declare(strict_types=1);

return [
    'up' => "CREATE TABLE `sa_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,
    `payment_model` VARCHAR(20) NOT NULL DEFAULT 'per_session' COMMENT 'per_session, per_player, monthly_fixed, hybrid',
    `hourly_rate` DECIMAL(10,2) NULL,
    `session_rate` DECIMAL(10,2) NULL,
    `monthly_rate` DECIMAL(10,2) NULL,
    `max_groups` INT UNSIGNED NOT NULL DEFAULT 10,
    `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,
    `branch_id` 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_coach_code` (`code`),
    INDEX `idx_sa_coach_nid` (`national_id`),
    INDEX `idx_sa_coach_active` (`is_active`, `is_archived`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;",
    'down' => "DROP TABLE IF EXISTS `sa_coaches`;"
];
