<?php

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

class CreateBookingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('bookings', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('branch_id')->nullable();
            $table->unsignedInteger('user_id')->nullable();
            $table->unsignedInteger('plot_id')->nullable();
            $table->string('ms')->nullable();
            $table->string('file_number')->nullable();
            $table->string('reference_number')->nullable();
            $table->enum('status', ['Unapprove','Approve','Cancel','Transfer','Reserved','Expired'])->default('Unapprove');
            $table->timestamp('approve_date')->nullable();
            $table->enum('plan_type', ['One Time','Installment','Quarter'])->nullable();
            $table->string('feature_description')->nullable();
            $table->double('feature_charges')->nullable();
            $table->double('discount')->nullable();
            $table->double('rate_per_marla')->nullable();
            $table->double('agreed_amount')->nullable();
            $table->double('remaining_amount')->nullable();
            
            $table->string('receipt_number')->nullable();
            $table->double('token_amount')->nullable();
            $table->integer('token_booking_part')->default(0);
            $table->string('mode')->nullable();
            $table->string('installment_mode')->nullable();
            $table->string('drawn_on')->nullable();
            $table->string('instrument')->nullable();
            $table->timestamp('instrument_date')->nullable();
            $table->string('remarks',500)->nullable();
            $table->enum('is_reserve', ['0','1'])->default('0');
            $table->timestamp('reserve_sdate')->nullable();
            $table->timestamp('reserve_edate')->nullable();
            $table->enum('is_resale', ['0','1'])->default('0');
            $table->enum('is_block', ['0','1'])->default('0');
            $table->enum('is_hotitem', ['0','1','2'])->default('0');
            $table->string('finger_print')->nullable();
            $table->string('raw_data')->nullable();
            $table->string('print_width')->nullable();
            $table->enum('is_recycle', ['0','1','2'])->default('0');


            // THESE FIELDS FOR IMPORT AND EXPORT DATA 
            $table->double('down_payment_amount')->nullable();
            $table->double('possession_amount')->nullable();
            $table->double('installment_amount')->nullable();
            $table->double('number_of_installment')->nullable();

            $table->timestamp('down_payment_date')->nullable();
            $table->timestamp('instalment_start_date')->nullable();
            $table->timestamp('possession_date')->nullable();







            $table->timestamps();
        });
    }

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