<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `form_schemas` (
            `id`            BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `form_code`     VARCHAR(50) NOT NULL,
            `name_ar`       VARCHAR(200) NOT NULL,
            `name_en`       VARCHAR(200) NULL,
            `form_fee`      DECIMAL(15,2) NOT NULL DEFAULT 0.00,
            `validity_days` INT UNSIGNED NULL,
            `schema_json`   JSON NOT NULL,
            `version`       INT UNSIGNED NOT NULL DEFAULT 1,
            `published_at`  TIMESTAMP NULL DEFAULT NULL,
            `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,
            `updated_by`    BIGINT UNSIGNED NULL,
            UNIQUE KEY `uq_form_schemas_code` (`form_code`),
            INDEX `idx_form_schemas_active` (`is_active`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `form_schemas`",
];