<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('loan_borrow_lists', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('invoice_no', 150)->unique();
            $table->bigInteger('loaner_company_id')->index();
            $table->bigInteger('borrower_company_id')->index();
            $table->bigInteger('worker_id')->index();
            $table->double('original_rate', 10, 2)->comment = 'Hard copy of worker rate without service charge';
            $table->double('rate', 10, 2)->comment = 'Hard copy of worker rate';
            $table->double('tax', 10, 2)->comment = 'Hard copy of government tax';
            $table->double('duration', 5, 2)->comment = 'duration(days) of worker need to render';
            $table->date('date_from');
            $table->date('date_to');
            $table->enum('status', [
                'Pending',
                'Work in progress',
                'Work Done',
                'Request Modification',
                'For Approval',
                'Approved'
            ])->comment = 'Status from borrowing company for invoice';
            $table->timestamps();
        });
    }

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