<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `hr_sick_leave_records` (
            `id`                    BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `employee_id`           BIGINT UNSIGNED NOT NULL,
            `leave_request_id`      BIGINT UNSIGNED NULL,
            `sick_leave_year_start` DATE NOT NULL,
            `period_number`         INT UNSIGNED NOT NULL COMMENT '1=first 3 months, 2=next 3 months',
            `pay_percentage`        DECIMAL(5,2) NOT NULL,
            `medical_committee_ref` VARCHAR(100) NULL,
            `medical_report_path`   VARCHAR(500) NULL,
            `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_hr_sick_employee` (`employee_id`),
            INDEX `idx_hr_sick_leave_req` (`leave_request_id`),
            INDEX `idx_hr_sick_year` (`sick_leave_year_start`),
            CONSTRAINT `fk_hr_sick_employee` FOREIGN KEY (`employee_id`) REFERENCES `employees`(`id`),
            CONSTRAINT `fk_hr_sick_leave_request` FOREIGN KEY (`leave_request_id`) REFERENCES `hr_leave_requests`(`id`) ON DELETE SET NULL
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `hr_sick_leave_records`",
];
