<?php
declare(strict_types=1);

return [
    'up' => "CREATE TABLE IF NOT EXISTS `pool_configurations` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `facility_id` BIGINT UNSIGNED NOT NULL,
    `name_ar` VARCHAR(255) NOT NULL,
    `name_en` VARCHAR(255) NULL,
    `length_meters` DECIMAL(5,2) NOT NULL,
    `width_meters` DECIMAL(5,2) NOT NULL,
    `depth_shallow` DECIMAL(3,2) NULL,
    `depth_deep` DECIMAL(3,2) NULL,
    `total_lanes_lengthwise` INT UNSIGNED NOT NULL DEFAULT 6,
    `total_lanes_widthwise` INT UNSIGNED NOT NULL DEFAULT 0,
    `lane_widths_json` JSON NOT NULL COMMENT 'array of widths per lane',
    `max_total_swimmers` INT UNSIGNED NOT NULL DEFAULT 50,
    `max_per_lane` INT UNSIGNED NOT NULL DEFAULT 8,
    `safety_ratio_json` JSON NULL COMMENT '{\"lap_swimming\":6,\"lessons\":4,\"free_swim\":8}',
    `operating_hours_json` JSON NULL COMMENT '{\"start\":\"06:00\",\"end\":\"22:00\",\"slot_minutes\":60}',
    `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,
    INDEX `idx_pc_facility` (`facility_id`),
    CONSTRAINT `fk_pc_facility` FOREIGN KEY (`facility_id`) REFERENCES `facilities`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS `pool_configurations`",
];
