<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS waiver_individual_fees (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    waiver_request_id BIGINT UNSIGNED NOT NULL,
    person_type ENUM('spouse','child','temporary') NOT NULL,
    person_id BIGINT UNSIGNED NOT NULL COMMENT 'FK to spouses/children/temporary_members',
    person_name VARCHAR(200) NOT NULL,
    person_order TINYINT UNSIGNED NOT NULL DEFAULT 1,
    fee_type ENUM('fixed','percentage') NULL,
    fee_rate DECIMAL(15,2) NULL COMMENT 'Fixed amount or percentage value',
    fee_amount DECIMAL(15,2) NOT NULL DEFAULT 0.00 COMMENT 'Calculated fee for this person',
    age_years INT UNSIGNED NULL COMMENT 'Age at time of waiver (children only)',
    age_category VARCHAR(50) NULL COMMENT 'under_12, 12_to_16, 16_to_18, 18_to_25, 25_plus',
    date_of_birth DATE NULL,
    relationship VARCHAR(30) NULL COMMENT 'son/daughter for children',
    status VARCHAR(50) NULL COMMENT 'active/frozen/etc',
    notes TEXT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_waiver_request (waiver_request_id),
    INDEX idx_person (person_type, person_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
",
    'down' => "DROP TABLE IF EXISTS waiver_individual_fees;",
];
