<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('adjustments_and_deductions', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('employee_id', 20)->index();
            $table->string('company_id', 20)->index();
            $table->string('dealer_id', 20)->index();
            $table->string('payroll_item_id', 20)->index();
            $table->decimal('amount', 12, 2);
            $table->date('date_from')->nullable();
            $table->date('date_to')->nullable();
            $table->boolean('recurring')->default(false);
            $table->tinyInteger('frequency');
            $table->string('add_less', 25)->nullable();
            $table->text('remarks')->nullable();
            $table->boolean('enabled')->default(true)->index();
            $table->softDeletes();
            $table->timestamps();
        });
    }

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