<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('tax_slabs', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->foreignId('fiscal_year_id')->constrained('fiscal_years')->cascadeOnDelete();
            $table->decimal('min_income', 12, 2);
            $table->decimal('max_income', 12, 2)
                ->nullable();
            $table->enum('tax_type', TaxSlabTypeEnum::casesAsArray());
            $table->decimal('tax_value', 12, 2);


            $table->enum('gender', ['male', 'female', 'other'])->nullable(); //skip for now
            $table->boolean('is_freedom_fighter')->default(false); //skip for now

            $table->boolean('is_disabled')->default(false);

            $table->enum('status', StatusEnum::casesAsArray())->default(StatusEnum::ACTIVE)->index();

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

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