<?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('employee_loans', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('employee_id',150)->index();
            $table->string('company_id',150)->index();
            $table->string('dealer_id',150)->index();
            $table->string('loan_id',150)->index();
            $table->string('amount',150);
            $table->string('frequency',5);
            $table->string('term',50);
            $table->string('monthly',50);
            $table->string('balance',255);
            $table->date('effectivity_date');
            $table->string('attachment',150)->nullable();
            $table->longText('remarks')->nullable();
            $table->boolean('paused')->default(false);
            $table->boolean('enabled')->default(true);
            $table->softDeletes();
            $table->timestamps();
        });
    }

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