<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS sa_institutions (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    code VARCHAR(30) NOT NULL,
    name_ar VARCHAR(300) NOT NULL,
    name_en VARCHAR(300) NULL,
    institution_type ENUM('school','university','company','club','government','other') NOT NULL DEFAULT 'school',
    contact_person VARCHAR(200) NULL,
    phone VARCHAR(30) NULL,
    email VARCHAR(200) NULL,
    address TEXT NULL,
    contract_start DATE NULL,
    contract_end DATE NULL,
    hourly_rate DECIMAL(10,2) NULL COMMENT 'default rate per hour',
    discount_percent DECIMAL(5,2) NOT NULL DEFAULT 0.00,
    max_participants INT UNSIGNED NULL,
    notes TEXT NULL,
    is_active TINYINT(1) NOT NULL DEFAULT 1,
    is_archived TINYINT(1) NOT NULL DEFAULT 0,
    archived_at TIMESTAMP NULL,
    archived_by BIGINT UNSIGNED NULL,
    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,
    UNIQUE KEY uq_inst_code (code),
    INDEX idx_inst_type (institution_type),
    INDEX idx_inst_active (is_active)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS sa_institutions"
];
