<?php

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

class CreateUnitTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('units', function (Blueprint $table) {
            $table->id();
            $table->string('applicant_name', 100);
            $table->string('nationality', 20);
            $table->string('dependent_no', 10);
            $table->string('adult', 10);
            $table->string('children', 10);
            $table->enum('id_type', ['iqama', 'passport']);
            $table->string('id_no', 30);
            $table->enum('rental_source', ['company', 'self']);
            $table->string('company_name',100)->nullable();
            $table->string('company_address',200)->nullable();
            $table->string('company_contact_no',15)->nullable();

            $table->string('person_name',100)->nullable();
            $table->string('person_address',200)->nullable();
            $table->string('person_contact_no',15)->nullable();
            $table->json('applicant_contact');
            $table->json('selected_compound');

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

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