<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `academy_levels` (
            `id`              BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `academy_id`      BIGINT UNSIGNED NOT NULL,
            `code`            VARCHAR(50) NOT NULL,
            `name_ar`         VARCHAR(200) NOT NULL,
            `name_en`         VARCHAR(200) NULL,
            `level_order`     INT UNSIGNED NOT NULL DEFAULT 0,
            `age_min`         INT UNSIGNED NULL,
            `age_max`         INT UNSIGNED NULL,
            `max_capacity`    INT UNSIGNED NULL,
            `config_json`     JSON NULL,
            `is_active`       TINYINT(1) NOT NULL DEFAULT 1,
            `created_at`      TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
            `updated_at`      TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
            INDEX `idx_academy_levels_academy` (`academy_id`),
            UNIQUE KEY `uq_academy_levels_code` (`academy_id`, `code`),
            CONSTRAINT `fk_academy_levels_academy` FOREIGN KEY (`academy_id`) REFERENCES `academies`(`id`) ON DELETE CASCADE
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `academy_levels`",
];
