<?php

use App\Enums\EntityStatus;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('last_name')->nullable();
            $table->string('profile_image')->nullable();
            $table->string('email')->unique();
            $table->string('password');
            $table->String('position')->nullable();
            $table->string('phone')->unique()->nullable();
            $table->string('cod_phone')->nullable();
            $table->timestamp('email_verified_at')->nullable();
            $table->enum('gender', ['M', 'F', 'other'])->nullable();
            $table->enum('entity_status', [EntityStatus::ACTIVE->value, EntityStatus::INACTIVE->value])->default(EntityStatus::ACTIVE->value);

            //Nota: Como esta llave esta en la tabla branch
            // $table->unsignedBigInteger('branch_id')->nullable();
            // $table->foreign('branch_id')->references('id')->on('branches');


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

        });
    }

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