<?php

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

class CreateDocumentationRequestsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('documentation_requests', function (Blueprint $table) {
            $table->id();
            $table->enum('type', ['inside_office', 'outside_office']);
            $table->enum('status', ['being_documented', 'documented']);
            $table->unsignedBigInteger('documentation_type_id')->index();
            $table->unsignedBigInteger('coupon_id')->nullable()->index();
            $table->unsignedBigInteger('city_id')->nullable();
            $table->unsignedBigInteger('user_id')->nullable()->index();
            $table->string('lat', 50)->nullable();
            $table->string('lng', 50)->nullable();
            $table->string('address', 200)->nullable();
            $table->string('user_name', 100);
            $table->string('user_phone', 15);
            $table->string('user_email', 100);
            $table->string('notes', 400);
            $table->date('documentation_date');
            $table->time('documentation_time');
            $table->enum('pay_way', ['visa_master_direct', 'visa_master_direct_3ds_flow','benefit', 'uae_debit_cards', 'knet', 'stc_pay', 'apple_pay', 'visa_master', 'mada', 'amex', 'sadad', 'qatar_debit_cards'])->nullable();
            $table->double('total')->nullable();
            $table->double('documentation_price')->nullable();

            $table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();

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

            $table->engine = 'InnoDB';
        });
    }

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