<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `depreciation_entries` (
            `id`                  BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `asset_id`            BIGINT UNSIGNED NOT NULL,
            `period_month`        VARCHAR(7) NOT NULL COMMENT 'YYYY-MM',
            `depreciation_amount` DECIMAL(15,2) NOT NULL,
            `accumulated_total`   DECIMAL(15,2) NOT NULL,
            `book_value_after`    DECIMAL(15,2) NOT NULL,
            `method_used`         VARCHAR(30) NOT NULL,
            `is_manual`           TINYINT(1) NOT NULL DEFAULT 0,
            `notes`               TEXT NULL,
            `created_at`          TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
            `created_by`          BIGINT UNSIGNED NULL,
            UNIQUE KEY `uq_dep_entries_asset_period` (`asset_id`, `period_month`),
            INDEX `idx_dep_entries_period` (`period_month`),
            CONSTRAINT `fk_dep_entries_asset` FOREIGN KEY (`asset_id`) REFERENCES `asset_register`(`id`) ON DELETE CASCADE
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `depreciation_entries`",
];
