<?php

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

class CreateCommissionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up() 
    {
        Schema::create('commissions', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('booking_id')->nullable();
            $table->unsignedInteger('user_id')->nullable();
            $table->unsignedInteger('role_id')->nullable();
            $table->string('commission_type')->nullable();
            $table->double('percentage')->nullable();
            $table->double('amount')->nullable();
            $table->double('received_amount')->nullable();
            $table->string('description', 500)->nullable();
            $table->enum('status', ['Paid', 'Unpaid'])->default('Unpaid');
            // $table->enum('payment_type', ['Revenue', 'Commission', 'Transfer', 'Refund', 'Deduction', 'Baloon Charges', 'Document Charges'])->nullable();
            $table->string('payment_type')->nullable();
            $table->enum('is_recycle', ['0', '1', '2'])->default('0');
            $table->timestamps();
        });
    }

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