<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('fixed_asset_categories', function (Blueprint $table) {
            $table->id();
            $table->string('category_code', 10)->unique();
            $table->string('category_name', 100);
            $table->string('depreciation_method', 30)->default('straight_line');
            $table->integer('default_useful_life_years')->default(5);
            $table->decimal('default_salvage_value_pct', 5, 2)->default(10.00);
            $table->enum('status', ['active', 'inactive'])->default('active');
            $table->text('description')->nullable();
            $table->timestamps();

            $table->index('category_code');
            $table->index('status');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('fixed_asset_categories');
    }
};
