<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `temporary_members` (
            `id`                          BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `member_id`                   BIGINT UNSIGNED NOT NULL,
            `category`                    VARCHAR(50) NOT NULL,
            `full_name_ar`                VARCHAR(200) NOT NULL,
            `full_name_en`                VARCHAR(200) NULL,
            `national_id`                 VARCHAR(14) NULL,
            `passport_number`             VARCHAR(50) NULL,
            `date_of_birth`               DATE NOT NULL,
            `age_years`                   INT UNSIGNED NULL,
            `age_months`                  INT UNSIGNED NULL,
            `gender`                      VARCHAR(10) NOT NULL,
            `nationality`                 VARCHAR(100) NULL DEFAULT 'مصري',
            `relationship_to_member`      VARCHAR(100) NULL,
            `has_championship`            TINYINT(1) NOT NULL DEFAULT 0,
            `disability_documentation`    TINYINT(1) NOT NULL DEFAULT 0,
            `addition_fee`                DECIMAL(15,2) NOT NULL DEFAULT 0.00,
            `fee_receipt_number`          VARCHAR(50) NULL,
            `can_separate`                TINYINT(1) NOT NULL DEFAULT 0,
            `can_get_independent`         TINYINT(1) NOT NULL DEFAULT 0,
            `status`                      VARCHAR(50) NOT NULL DEFAULT 'active',
            `photo_path`                  VARCHAR(500) NULL,
            `notes`                       TEXT NULL,
            `is_archived`                 TINYINT(1) NOT NULL DEFAULT 0,
            `archived_at`                 TIMESTAMP NULL DEFAULT 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,
            INDEX `idx_temp_members_member` (`member_id`),
            INDEX `idx_temp_members_category` (`category`),
            INDEX `idx_temp_members_nid` (`national_id`),
            INDEX `idx_temp_members_status` (`status`),
            INDEX `idx_temp_members_archived` (`is_archived`),
            CONSTRAINT `fk_temp_members_member` FOREIGN KEY (`member_id`) REFERENCES `members`(`id`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `temporary_members`",
];