<?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::table('employee_additions', function (Blueprint $table) {
            $table->string('value_type')->default('fixed')->after('addition_type_id');
            $table->decimal('percentage', 5, 2)->nullable()->after('amount');
        });

        Schema::table('employee_deductions', function (Blueprint $table) {
            $table->string('value_type')->default('percentage')->after('deduction_type_id');
            $table->decimal('amount', 12, 2)->nullable()->after('percentage');
        });
    }

    public function down(): void
    {
        Schema::table('employee_additions', function (Blueprint $table) {
            $table->dropColumn(['value_type', 'percentage']);
        });

        Schema::table('employee_deductions', function (Blueprint $table) {
            $table->dropColumn(['value_type', 'amount']);
        });
    }
};
