<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS sa_makeup_sessions (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    player_id BIGINT UNSIGNED NOT NULL,
    original_group_id BIGINT UNSIGNED NOT NULL,
    missed_session_date DATE NOT NULL,
    missed_reason VARCHAR(500) NULL,
    makeup_group_id BIGINT UNSIGNED NULL COMMENT 'group where makeup will be taken',
    makeup_date DATE NULL,
    status ENUM('eligible','scheduled','completed','expired','cancelled') NOT NULL DEFAULT 'eligible',
    expires_at DATE NOT NULL COMMENT 'deadline to use this makeup',
    scheduled_by BIGINT UNSIGNED NULL,
    completed_at TIMESTAMP 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_ms_player (player_id),
    INDEX idx_ms_status (status),
    INDEX idx_ms_expires (expires_at),
    INDEX idx_ms_original_group (original_group_id, missed_session_date)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS sa_makeup_sessions"
];
