<?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('borrow_pending_workers', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('search_id');
            $table->bigInteger('borrow_request_id')->index();
            $table->bigInteger('worker_id')->index();
            $table->date('date_from');
            $table->date('date_to');
            $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->longText('approver_note')->nullable()->comment = 'Approver  note';
            $table->enum('status', ['Pending', 'Approved', 'Declined', 'Cancelled'])->default('Pending');
            $table->timestamps();
        });
    }

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