<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `seasonal_memberships` (
            `id`                 BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `member_id`          BIGINT UNSIGNED NOT NULL,
            `branch_id`          BIGINT UNSIGNED NOT NULL,
            `start_date`         DATE NOT NULL,
            `end_date`           DATE NOT NULL,
            `fee_amount`         DECIMAL(15,2) NOT NULL,
            `fee_receipt_number` VARCHAR(50) NULL,
            `status`             VARCHAR(50) NOT NULL DEFAULT 'active',
            `carnet_marking`     VARCHAR(100) 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_seasonal_member` (`member_id`),
            INDEX `idx_seasonal_status` (`status`),
            INDEX `idx_seasonal_dates` (`start_date`, `end_date`),
            CONSTRAINT `fk_seasonal_member` FOREIGN KEY (`member_id`) REFERENCES `members`(`id`),
            CONSTRAINT `fk_seasonal_branch` FOREIGN KEY (`branch_id`) REFERENCES `branches`(`id`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `seasonal_memberships`",
];