<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `employee_permissions` (
            `id`              BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `employee_id`     BIGINT UNSIGNED NOT NULL,
            `permission_key`  VARCHAR(100) NOT NULL,
            `is_denied`       TINYINT(1) NOT NULL DEFAULT 0,
            `granted_at`      TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
            `granted_by`      BIGINT UNSIGNED NULL,
            `notes`           VARCHAR(500) NULL,
            UNIQUE KEY `uq_emp_perm` (`employee_id`, `permission_key`),
            INDEX `idx_emp_perms_key` (`permission_key`),
            CONSTRAINT `fk_emp_perms_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 `employee_permissions`",
];
