<?php

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

class CreateQuotationTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('quotation', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('client_id')->nullable()->unsigned();
            $table->foreign('client_id')->references('id')->on('clients');
            $table->string('name')->nullable();
            $table->bigInteger('created_by_user_id')->nullable()->unsigned();
            $table->foreign('created_by_user_id')->references('id')->on('users');
            $table->string('file')->nullable();
            $table->string('reference_no')->nullable();
            $table->bigInteger('reviewed_by_user_id')->nullable()->unsigned();
            $table->foreign('reviewed_by_user_id')->references('id')->on('users');
            $table->bigInteger('tnc_id')->nullable()->unsigned();
            $table->foreign('tnc_id')->references('id')->on('terms_and_conditaions');
            $table->bigInteger('payment_status_id')->nullable()->unsigned();
            $table->foreign('payment_status_id')->references('id')->on('payment_status');
            $table->double('total_amount')->default(0)->nullable();
            $table->bigInteger('indirect_tax_id')->nullable()->unsigned();
            $table->foreign('indirect_tax_id')->references('id')->on('indirect_tax');
            $table->timestamps();
            $table->softDeletes();
        });
    }

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