<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Modules\Core\Enums\StatusEnum;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('tax_configurations', function (Blueprint $table) {
            $table->id();
            $table->foreignId('fiscal_year_id')->constrained('fiscal_years')->cascadeOnDelete();

            $table->decimal('minimum_tax', 12, 2)
                ->default(0);

            $table->decimal('investment_rebate_percentage', 8, 2)
                ->default(0); //no need data pass form

            $table->decimal('maximum_rebate_amount', 12, 2)
                ->default(0);  //no need data pass form
            $table->enum('status', StatusEnum::casesAsArray())->default(StatusEnum::ACTIVE)->index();

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('tax_configurations');
    }
};
