<?php
declare(strict_types=1);
return [
    'up' => "CREATE TABLE `coach_payments` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `coach_id` BIGINT UNSIGNED NOT NULL,
    `payment_period` VARCHAR(7) NOT NULL COMMENT 'YYYY-MM format',
    `payment_model` VARCHAR(30) NOT NULL COMMENT 'per_session, per_player, monthly_fixed, hybrid',
    `sessions_conducted` INT UNSIGNED NOT NULL DEFAULT 0,
    `total_players_served` INT UNSIGNED NOT NULL DEFAULT 0,
    `base_amount` DECIMAL(10,2) NOT NULL DEFAULT 0,
    `bonus` DECIMAL(10,2) NOT NULL DEFAULT 0,
    `deductions` DECIMAL(10,2) NOT NULL DEFAULT 0,
    `net_amount` DECIMAL(10,2) NOT NULL DEFAULT 0,
    `calculation_json` JSON NULL,
    `status` VARCHAR(20) NOT NULL DEFAULT 'draft' COMMENT 'draft, approved, paid',
    `approved_by` BIGINT UNSIGNED NULL,
    `approved_at` TIMESTAMP NULL,
    `paid_at` TIMESTAMP NULL,
    `notes` TEXT NULL,
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    INDEX `idx_cp_coach` (`coach_id`),
    INDEX `idx_cp_period` (`payment_period`),
    UNIQUE KEY `uk_cp_coach_period` (`coach_id`, `payment_period`),
    CONSTRAINT `fk_cp_coach` FOREIGN KEY (`coach_id`) REFERENCES `coaches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS `coach_payments`",
];
