<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `workflow_transition_log` (
            `id`                       BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `workflow_instance_id`     BIGINT UNSIGNED NOT NULL,
            `from_state`               VARCHAR(50) NOT NULL,
            `to_state`                 VARCHAR(50) NOT NULL,
            `transition_name`          VARCHAR(100) NOT NULL,
            `triggered_by_employee_id` BIGINT UNSIGNED NULL,
            `trigger_type`             VARCHAR(30) NOT NULL DEFAULT 'manual',
            `guard_results_json`       JSON NULL,
            `notes`                    TEXT NULL,
            `created_at`               TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
            INDEX `idx_wf_trans_log_inst` (`workflow_instance_id`),
            INDEX `idx_wf_trans_log_date` (`created_at`),
            CONSTRAINT `fk_wf_trans_log_inst` FOREIGN KEY (`workflow_instance_id`) REFERENCES `workflow_instances`(`id`) ON DELETE CASCADE
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `workflow_transition_log`",
];