<?php

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

return new class extends Migration
{
     public function up()
    {
        Schema::table('leave_type_master', function (Blueprint $table) {

            $table->tinyInteger('Alw_Gen')->default(1)->after('Max_days');
            $table->tinyInteger('Min_ApBf')->default(1)->after('Alw_Gen');
            $table->tinyInteger('Min_ApDy')->default(1)->after('Min_ApBf');
            $table->tinyInteger('Max_ApDy')->default(1)->after('Min_ApDy');

            $table->enum('Acr_Plcy', ['YEARLY','HALF_YEARLY','QUARTERLY','MONTHLY'])
                  ->after('Max_ApDy');

            $table->smallInteger('Acr_Days')->default(1)->after('Acr_Plcy');

            $table->tinyInteger('Is_Encash')->default(1)->after('Acr_Days');
            $table->tinyInteger('Is_CryFw')->default(1)->after('Is_Encash');
            $table->tinyInteger('Max_CfAl')->default(1)->after('Is_CryFw');
            $table->tinyInteger('Is_HfDy')->default(1)->after('Max_CfAl');
        });
    }

    public function down()
    {
        Schema::table('leave_type_master', function (Blueprint $table) {
            $table->dropColumn([
                'Alw_Gen',
                'Min_ApBf',
                'Min_ApDy',
                'Max_ApDy',
                'Acr_Plcy',
                'Acr_Days',
                'Is_Encash',
                'Is_CryFw',
                'Max_CfAl',
                'Is_HfDy'
            ]);
        });
    }
};
