<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS `permission_audit_log` (
    `id`             BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `employee_id`    BIGINT UNSIGNED NOT NULL,
    `action`         ENUM('role_assigned','role_removed','perm_granted','perm_denied','perm_removed','branch_added','branch_removed') NOT NULL,
    `target_type`    VARCHAR(50) NOT NULL,
    `target_value`   VARCHAR(200) NOT NULL,
    `performed_by`   BIGINT UNSIGNED NOT NULL,
    `performed_at`   TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `notes`          TEXT NULL,
    INDEX `idx_perm_audit_emp` (`employee_id`),
    INDEX `idx_perm_audit_date` (`performed_at`),
    CONSTRAINT `fk_perm_audit_emp` FOREIGN KEY (`employee_id`) REFERENCES `employees`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
",
    'down' => "DROP TABLE IF EXISTS `permission_audit_log`",
];
