<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `pricing_configs` (
            `id`               BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `branch_id`        BIGINT UNSIGNED NOT NULL,
            `qualification_id` BIGINT UNSIGNED NOT NULL,
            `membership_type`  VARCHAR(50) NOT NULL DEFAULT 'working',
            `price`            DECIMAL(15,2) NOT NULL,
            `currency`         VARCHAR(3) NOT NULL DEFAULT 'EGP',
            `effective_from`   DATE NOT NULL,
            `effective_to`     DATE NULL DEFAULT NULL,
            `is_active`        TINYINT(1) NOT NULL DEFAULT 1,
            `notes`            TEXT 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,
            INDEX `idx_pricing_branch` (`branch_id`),
            INDEX `idx_pricing_qual` (`qualification_id`),
            INDEX `idx_pricing_type` (`membership_type`),
            INDEX `idx_pricing_effective` (`effective_from`, `effective_to`),
            CONSTRAINT `fk_pricing_branch` FOREIGN KEY (`branch_id`) REFERENCES `branches`(`id`),
            CONSTRAINT `fk_pricing_qual` FOREIGN KEY (`qualification_id`) REFERENCES `qualifications`(`id`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `pricing_configs`",
];