<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE `treasury_deposits` (
    `id`                    BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `deposit_number`        VARCHAR(30) NOT NULL UNIQUE,
    `treasury_id`           BIGINT UNSIGNED NOT NULL,
    `bank_account_id`       BIGINT UNSIGNED NULL,
    `amount`                DECIMAL(14,2) NOT NULL,
    `deposit_date`          DATE NOT NULL,
    `bank_receipt_serial`   VARCHAR(100) NULL,
    `bank_receipt_path`     VARCHAR(255) NULL,
    `deposited_by`          BIGINT UNSIGNED NOT NULL,
    `deposited_at`          TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `confirmed_by`          BIGINT UNSIGNED NULL,
    `confirmed_at`          TIMESTAMP NULL,
    `status`                ENUM('pending_deposit','deposited','confirmed','rejected') NOT NULL DEFAULT 'pending_deposit',
    `rejection_reason`      TEXT NULL,
    `journal_entry_id`      BIGINT UNSIGNED NULL,
    `notes`                 TEXT NULL,
    `created_at`            TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at`            TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX `idx_deposits_treasury` (`treasury_id`),
    INDEX `idx_deposits_status` (`status`),
    INDEX `idx_deposits_date` (`deposit_date`),
    CONSTRAINT `fk_deposits_treasury` FOREIGN KEY (`treasury_id`) REFERENCES `treasuries`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
",
    'down' => "DROP TABLE IF EXISTS `treasury_deposits`",
];
