<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('workers', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('worker_id', 50)->nullable();
            $table->string('first_name', 50);
            $table->string('last_name', 50);
            $table->string('email_address')->unique();
            $table->string('password');
            $table->string('email_verification_code')->nullable();
            $table->timestamp('email_verified_at')->nullable();
            $table->binary('profile_picture')->nullable();
            $table->enum('is_active', ['true', 'false']);
            $table->string('phone_num', 50)->nullable();;
            $table->enum('enable_2fa', ['true', 'false'])->default('false');
            $table->string('email_code' , 6)->nullable();
            $table->string('mobile_code' , 6)->nullable();
            $table->timestamp('mobile_code_expiration')->nullable();
            $table->timestamp('blocked_expiration')->nullable();
            $table->string('new_email_address')->unique()->nullable();
            $table->string('street_address', 50)->nullable();
            $table->string('city', 50)->nullable();
            $table->string('state', 50)->nullable();
            $table->string('zipcode', 10)->nullable();
            $table->decimal('rate', 10, 2)->nullable()->comment = 'Worker rate + overheaded charge';
            $table->decimal('flat_rate', 10, 2)->default(0)->comment = 'Worker hourly rate';
            $table->decimal('burden_rate_amount', 10, 2)->default(0)->comment = 'Worker experience burden rate charge';
            $table->decimal('overhead_charge', 10, 2)->default(0)->comment = 'Worker overheaded charge';;
            $table->enum('overhead_type', ['real', 'percent'])->default('percent');
            $table->date('date_hired')->nullable();
            $table->longText('additional_details')->nullable();
            $table->enum('is_account_disabled', ['true', 'false'])->default('false');
            $table->date('availability_start_date')->nullable();
            $table->date('availability_end_date')->nullable();
            $table->longText('resume_file_name')->nullable();
            $table->smallInteger('distance')->nullable();
            $table->rememberToken();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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