<?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;
use Modules\HR\Enums\EligibilityEnum;

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

            $table->string('festival_name');

            $table->enum('eligibility', [
                EligibilityEnum::casesAsArray()
            ])->default(EligibilityEnum::ALL);

            $table->foreignId('religion_id')->nullable()->constrained('religions')->nullOnDelete();

            $table->enum('bonus_type', [
                TaxSlabTypeEnum::casesAsArray()
            ])->default(TaxSlabTypeEnum::PERCENTAGE);

            $table->decimal('bonus_value', 12, 2);
            /*
            minimum service days
            */
            $table->integer('minimum_service_days')
                ->default(0);

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

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

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