<?php

use App\Classes\ValueObjects\Constants\UserRoles;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up(): void {

        $faker = \Faker\Factory::create();

        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('first_name', 60);
            $table->string('last_name', 60);
            $table->string('email')->unique();
            $table->string('password');
            $table->boolean('verified')->default(0);
            $table->smallInteger('role_id');
            $table->rememberToken();
            $table->timestamps();
        });

//        DB::table('users')->insert([
//            [
//                'first_name' => 'Omair',
//                'last_name' => 'Saleh',
//                'email' => 'omair@izyim.com',
//                'password' => Hash::make('123456abcabc'),
//                'verified' => 1,
//                'role_id' => UserRoles::SUPER_ADMIN,
//                'created_at' =>  \Carbon\Carbon::now(),
//                'updated_at' => \Carbon\Carbon::now()
//            ],
//            [
//                'first_name' => 'Development',
//                'last_name' => 'User',
//                'email' => env('EMAIL_DEVELOPMENT', 'dev@izyim.com'),
//                'password' => Hash::make('123456abcabc'),
//                'verified' => 1,
//                'role_id' => UserRoles::ADMIN,
//                'created_at' =>  \Carbon\Carbon::now(),
//                'updated_at' => \Carbon\Carbon::now()
//            ]
//        ]);
    }

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