<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `hr_employee_documents` (
            `id`                    BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `employee_profile_id`   BIGINT UNSIGNED NOT NULL,
            `document_type`         VARCHAR(50) NOT NULL COMMENT 'national_id_copy, birth_certificate, degree, military_cert, insurance_form1, insurance_form2, insurance_form6, tax_card, criminal_record, medical_report, contract_copy, photo, experience_cert, other',
            `title_ar`              VARCHAR(300) NOT NULL,
            `original_filename`     VARCHAR(500) NOT NULL,
            `stored_filename`       VARCHAR(500) NOT NULL,
            `file_path`             VARCHAR(1000) NOT NULL,
            `file_size`             INT UNSIGNED NOT NULL DEFAULT 0,
            `mime_type`             VARCHAR(100) NOT NULL,
            `expiry_date`           DATE NULL,
            `is_verified`           TINYINT(1) NOT NULL DEFAULT 0,
            `verified_by`           BIGINT UNSIGNED NULL,
            `verified_at`           TIMESTAMP NULL DEFAULT NULL,
            `notes`                 TEXT NULL,
            `uploaded_by`           BIGINT UNSIGNED 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,
            `is_archived`           TINYINT(1) NOT NULL DEFAULT 0,
            `archived_at`           TIMESTAMP NULL DEFAULT NULL,
            `archived_by`           BIGINT UNSIGNED NULL,
            INDEX `idx_hr_docs_employee` (`employee_profile_id`),
            INDEX `idx_hr_docs_type` (`document_type`),
            INDEX `idx_hr_docs_expiry` (`expiry_date`),
            INDEX `idx_hr_docs_archived` (`is_archived`),
            CONSTRAINT `fk_hr_docs_employee` FOREIGN KEY (`employee_profile_id`) REFERENCES `hr_employee_profiles`(`id`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `hr_employee_documents`",
];
