<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `hr_holidays` (
            `id`                    BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `name_ar`               VARCHAR(200) NOT NULL,
            `name_en`               VARCHAR(200) NULL,
            `holiday_type`          VARCHAR(20) NOT NULL COMMENT 'national, religious, company',
            `date`                  DATE NULL,
            `duration_days`         INT UNSIGNED NOT NULL DEFAULT 1,
            `is_recurring`          TINYINT(1) NOT NULL DEFAULT 0,
            `recurring_month`       INT UNSIGNED NULL,
            `recurring_day`         INT UNSIGNED NULL,
            `religion`              VARCHAR(20) NULL DEFAULT NULL COMMENT 'null=all, muslim, christian',
            `year`                  YEAR 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,
            `created_by`            BIGINT UNSIGNED NULL,
            `updated_by`            BIGINT UNSIGNED NULL,
            `is_archived`           TINYINT(1) NOT NULL DEFAULT 0,
            `archived_at`           TIMESTAMP NULL DEFAULT NULL,
            `archived_by`           BIGINT UNSIGNED NULL,
            INDEX `idx_hr_holidays_date` (`date`),
            INDEX `idx_hr_holidays_year` (`year`),
            INDEX `idx_hr_holidays_type` (`holiday_type`),
            CONSTRAINT `chk_hr_holidays_type` CHECK (`holiday_type` IN ('national', 'religious', 'company'))
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `hr_holidays`",
];
