<?php
declare(strict_types=1);

return [
    'up' => "CREATE TABLE IF NOT EXISTS `facility_grids` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `facility_id` BIGINT UNSIGNED NOT NULL,
    `name_ar` VARCHAR(300) NOT NULL,
    `name_en` VARCHAR(300) NULL,
    `grid_type` VARCHAR(20) NOT NULL DEFAULT 'generic' COMMENT 'generic, pool, court',
    `rows_count` INT UNSIGNED NOT NULL DEFAULT 4,
    `cols_count` INT UNSIGNED NOT NULL DEFAULT 6,
    `row_label_ar` VARCHAR(50) NULL DEFAULT 'صف',
    `col_label_ar` VARCHAR(50) NULL DEFAULT 'عمود',
    `physical_length` DECIMAL(5,2) NULL COMMENT 'meters',
    `physical_width` DECIMAL(5,2) NULL COMMENT 'meters',
    `config_json` JSON NULL COMMENT 'type-specific: depths, operating_hours, safety_ratios',
    `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_fg_facility` (`facility_id`),
    INDEX `idx_fg_type` (`grid_type`),
    CONSTRAINT `fk_fg_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 `facility_grids`",
];
