<?php

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

class CreateSettlementMakerCheckerTable extends Migration
{
    public function up()
    {
        Schema::create('settlement_maker_checker', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('application_id')->index();
            $table->integer('collection_action_id')->index();
            $table->integer('maker_id')->nullable();
            $table->integer('checker_id')->nullable();
            $table->decimal('pos', 15, 2)->nullable();
            $table->decimal('settlement_amount', 15, 2)->nullable();
            $table->decimal('waiver_percentage', 8, 2)->nullable();
            $table->integer('requested_to_user_id')->nullable();
            $table->enum('status', ['pending', 'approved', 'rejected'])->default('pending');
            $table->text('remark')->nullable();
            $table->timestamp('action_at')->nullable();
            $table->softDeletes();
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::dropIfExists('settlement_maker_checker');
    }
}
