<?php

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

class CreateListingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('listings', function (Blueprint $table) {
            $table->id();
            $table->integer('ref_id')->nullable();
            $table->integer('vendor_id')->nullable()->index();
            $table->integer('city_id')->nullable()->index();
            $table->integer('purpose_id')->nullable()->index();
            $table->integer('property_type_id')->nullable()->index();
            $table->integer('unit_type_id')->nullable()->index();
            $table->integer('completion_status_id')->nullable()->index();
            $table->integer('rent_frequency_id')->nullable()->index();
            $table->integer('cheque_id')->nullable()->index();
            $table->integer('development_status_id')->nullable()->index();
            $table->integer('sale_status_id')->nullable()->index();
            $table->integer('ownership_status_id')->nullable()->index();
            $table->integer('location_id')->nullable()->index();
            $table->integer('developer_id')->nullable()->index();
            $table->integer('project_id')->nullable()->index();
            $table->integer('district_id')->nullable()->index();
            $table->string('p_id', 100)->nullable();
            $table->string('title', 300)->nullable();
            $table->string('slug', 600)->nullable();
            $table->string('property_type_title', 50)->nullable()->index();
            $table->string('short_desc', 300)->nullable();
            $table->longText('full_desc')->nullable();
            $table->tinyInteger('status')->default(2)->comment('1 for public, 2 for private');
            $table->tinyInteger('is_featured')->default(2)->comment('1 for Yes, 2 for No');
            $table->tinyInteger('is_verified')->default(2)->comment('1 for Yes, 2 for No');
            $table->tinyInteger('type')->default(1)->comment('1 for wip, 2 for listing')->index();
            $table->string('price', 10)->nullable();
            $table->string('area', 10)->nullable();
            $table->string('max_area', 10)->nullable();
            $table->string('thumb_image', 100)->nullable();
            $table->string('brochure', 100)->nullable();
            $table->string('meta_title', 300)->nullable();
            $table->string('meta_keywords', 300)->nullable();
            $table->string('meta_desc', 300)->nullable();
            $table->string('features', 200)->nullable();
            $table->string('contacts', 200)->nullable()->index();
            $table->string('beds', 10)->nullable();
            $table->string('max_beds', 10)->nullable();
            $table->string('baths', 10)->nullable();
            $table->string('max_baths', 10)->nullable();
            $table->string('lat', 100)->nullable();
            $table->string('lng', 100)->nullable();
            $table->string('location', 300)->nullable();
            $table->longText('gallery')->nullable();
            $table->longText('listing_details')->nullable();
            $table->string('project_completion_date', 20)->nullable();
            $table->integer('added_by')->nullable()->index();
            $table->integer('updated_by')->nullable()->index();
            $table->integer('deleted_by')->nullable()->index();
            $table->softDeletes();
            $table->timestamps();
        });
    }

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