<?php
declare(strict_types=1);

return [
    'up' => "CREATE TABLE `sa_time_brackets` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `facility_id` BIGINT UNSIGNED NOT NULL,
    `name_ar` VARCHAR(100) NOT NULL,
    `name_en` VARCHAR(100) NULL,
    `bracket_type` VARCHAR(20) NOT NULL COMMENT 'peak, off_peak, weekend, holiday',
    `start_time` TIME NOT NULL,
    `end_time` TIME NOT NULL,
    `days_of_week_json` JSON NOT NULL COMMENT '[0,1,2,3,4,5,6]',
    `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_sa_tb_facility` (`facility_id`),
    INDEX `idx_sa_tb_type` (`bracket_type`),
    CONSTRAINT `fk_sa_tb_facility` FOREIGN KEY (`facility_id`) REFERENCES `sa_facilities`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;",
    'down' => "DROP TABLE IF EXISTS sa_time_brackets;"
];
