<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS death_case_audit_log (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    death_case_id BIGINT UNSIGNED NOT NULL,
    action_type VARCHAR(50) NOT NULL,
    action_description_ar TEXT NOT NULL,
    affected_entity_type VARCHAR(50) NULL,
    affected_entity_id BIGINT UNSIGNED NULL,
    performed_by BIGINT UNSIGNED NULL,
    performed_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    details_json JSON NULL,
    INDEX idx_death_case (death_case_id),
    INDEX idx_entity (affected_entity_type, affected_entity_id),
    INDEX idx_performed_at (performed_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
",
    'down' => "DROP TABLE IF EXISTS death_case_audit_log;"
];
