<?php

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

class CreateTableContracts extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
	    Schema::create('contracts', function(Blueprint $table) {
	    	$table->increments('id');
	    	$table->integer('room_id')->nullable();
	    	$table->date('date_contract')->nullable();
	    	$table->date('date_enable')->nullable();
	    	$table->date('start_date')->nullable();
	    	$table->date('end_date')->nullable();
	    	$table->integer('room_price')->default(0);
	    	$table->integer('period')->nullbale();
	    	$table->integer('type_rent')->nullable();
	    	$table->boolean('is_collected')->default(false);
	    	$table->date('collect_to')->nullable();
	    	$table->integer('deposit')->default(0);
	    	$table->string('phone')->nullable();
	    	$table->string('name')->nullable();
	    	$table->string('id_number')->nullable();
	    	$table->string('email')->nullable();
	    	$table->date('date_join')->nullable();
	    	$table->string('customer_image')->nullable();
	    	$table->softDeletes();
	    	$table->timestamps();
	    });

	    Schema::create('contract_fees', function(Blueprint $table) {
	    	$table->increments('id');
	    	$table->integer('contract_id')->nullable();
	    	$table->integer('fee_id')->nullable();
	    	$table->timestamps();
	    });

	    Schema::create('electric_quota', function(Blueprint $table) {
	    	$table->increments('id');
	    	$table->integer('hostel_id')->nullable();
	    	$table->integer('quota_1')->nullable();
	    	$table->integer('price_quota_1')->nullable();

		    $table->integer('quota_2')->nullable();
		    $table->integer('price_quota_2')->nullable();

		    $table->integer('quota_3')->nullable();
		    $table->integer('price_quota_3')->nullable();

		    $table->integer('quota_4')->nullable();
		    $table->integer('price_quota_4')->nullable();

		    $table->integer('quota_5')->nullable();
		    $table->integer('price_quota_5')->nullable();

		    $table->integer('quota_6')->nullable();
		    $table->integer('price_quota_6')->nullable();

		    $table->integer('quota_7')->nullable();
		    $table->integer('price_quota_7')->nullable();

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


	    Schema::create('water_quota', function(Blueprint $table) {
		    $table->increments('id');
		    $table->integer('hostel_id')->nullable();
		    $table->integer('quota_1')->nullable();
		    $table->integer('price_quota_1')->nullable();

		    $table->integer('quota_2')->nullable();
		    $table->integer('price_quota_2')->nullable();

		    $table->integer('quota_3')->nullable();
		    $table->integer('price_quota_3')->nullable();

		    $table->integer('quota_4')->nullable();
		    $table->integer('price_quota_4')->nullable();

		    $table->integer('quota_5')->nullable();
		    $table->integer('price_quota_5')->nullable();

		    $table->integer('quota_6')->nullable();
		    $table->integer('price_quota_6')->nullable();

		    $table->integer('quota_7')->nullable();
		    $table->integer('price_quota_7')->nullable();

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

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