<?php
declare(strict_types=1);

return [
    'up' => "CREATE TABLE `member_referral_commissions` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `representative_id` INT UNSIGNED NOT NULL,
    `member_id` BIGINT UNSIGNED NOT NULL,
    `membership_value` DECIMAL(15,2) NOT NULL,
    `commission_rate` DECIMAL(5,2) NOT NULL,
    `commission_amount` DECIMAL(15,2) NOT NULL,
    `commission_date` DATE NOT NULL,
    `status` ENUM('pending','approved','paid') NOT NULL DEFAULT 'pending',
    `paid_at` DATETIME NULL,
    `notes` VARCHAR(500) NULL,
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX `idx_mrc_rep` (`representative_id`),
    INDEX `idx_mrc_member` (`member_id`),
    INDEX `idx_mrc_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;",

    'down' => "DROP TABLE IF EXISTS `member_referral_commissions`;",
];
