<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `violations` (
            `id`              BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `member_id`       BIGINT UNSIGNED NOT NULL,
            `violation_date`  DATE NOT NULL,
            `description`     TEXT NOT NULL,
            `reported_by`     BIGINT UNSIGNED NULL,
            `evidence_notes`  TEXT NULL,
            `status`          VARCHAR(50) NOT NULL DEFAULT 'reported',
            `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,
            INDEX `idx_violations_member` (`member_id`),
            INDEX `idx_violations_status` (`status`),
            INDEX `idx_violations_date` (`violation_date`),
            CONSTRAINT `fk_violations_member` FOREIGN KEY (`member_id`) REFERENCES `members`(`id`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `violations`",
];