<?php

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

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('branch_id')->nullable();
            $table->unsignedInteger('designation_id')->nullable();
            $table->unsignedInteger('transaction_id')->nullable();
            $table->unsignedInteger('vendor_type_id')->nullable();
            $table->string('code')->nullable();
            $table->string('employee_type')->nullable();
            $table->string('name')->nullable();
            $table->string('fname')->nullable();
            $table->string('agency_name')->nullable();
            $table->enum('relation', ['S/O', 'D/O', 'W/O'])->default('S/O');
            $table->enum('gender', ['Male', 'Female'])->default('Male');
            $table->string('blood_group')->nullable();
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->string('cnic', 1000)->nullable();
            $table->string('nationality')->nullable();
            $table->string('occupation')->nullable();
            $table->string('contact')->nullable();
            $table->string('salary_mode')->nullable();
            $table->string('bank_branch')->nullable();
            $table->string('bank_name')->nullable();
            $table->string('account_no')->nullable();
            $table->timestamp('dob')->nullable();
            $table->string('temp_address')->nullable();
            $table->string('per_address')->nullable();
            $table->string('agency_address')->nullable();
            $table->string('other_contact')->nullable();
            $table->string('passport')->nullable();
            $table->integer('is_filer')->default(0);
            $table->string('dp')->default('/graphics/logo/user.png');
            $table->string('type', 25)->nullable();
            $table->json('user_rights')->nullable();
            $table->json('leave_rules')->nullable();
            $table->string('employee_form')->nullable();
            $table->enum('status', ['Active', 'Deactive'])->default('Deactive');
            $table->enum('is_recycle', ['0', '1', '2'])->default('0');
            $table->string('ntn')->nullable();
            $table->string('stn')->nullable();
            $table->string('strn')->nullable();
            $table->double('opening_balance')->nullable();
            $table->timestamp('incometax_date')->nullable();
            $table->timestamp('saletax_date')->nullable();


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

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