<?php
declare(strict_types=1);

return [
    'up' => "CREATE TABLE IF NOT EXISTS `facility_grid_zones` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `grid_id` BIGINT UNSIGNED NOT NULL,
    `row_index` INT UNSIGNED NOT NULL,
    `col_index` INT UNSIGNED NOT NULL,
    `label` VARCHAR(100) NULL,
    `zone_type` VARCHAR(20) NULL COMMENT 'lane, section, cell',
    `width_meters` DECIMAL(4,2) NULL,
    `max_occupants` INT UNSIGNED NOT NULL DEFAULT 5,
    `is_active` TINYINT(1) NOT NULL DEFAULT 1,
    `sort_order` INT UNSIGNED NOT NULL DEFAULT 0,
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX `idx_fgz_grid` (`grid_id`),
    UNIQUE KEY `uq_fgz_position` (`grid_id`, `row_index`, `col_index`),
    CONSTRAINT `fk_fgz_grid` FOREIGN KEY (`grid_id`) REFERENCES `facility_grids`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS `facility_grid_zones`",
];
