<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS `board_offer_tiers` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `board_offer_id` BIGINT UNSIGNED NOT NULL,
    `tier_order` TINYINT UNSIGNED NOT NULL DEFAULT 1,
    `tier_name_ar` VARCHAR(100) NOT NULL,
    `payment_type` ENUM('cash', 'installment') NOT NULL,
    `cash_discount_pct` DECIMAL(5,2) NULL,
    `down_payment_pct` DECIMAL(5,2) NULL,
    `months` INT UNSIGNED NULL,
    `interest_rate` DECIMAL(5,2) NULL DEFAULT 0,
    `is_active` TINYINT(1) NOT NULL DEFAULT 1,
    `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX `idx_offer_tiers_offer` (`board_offer_id`),
    UNIQUE KEY `uq_offer_tier_order` (`board_offer_id`, `tier_order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
",
    'down' => "DROP TABLE IF EXISTS `board_offer_tiers`;",
];
