<?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('engineers', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->string('name')->nullable();
            $table->string('email')->unique();
            $table->string('profile_photo_path', 2048)->nullable();
            $table->string('tag_line')->nullable();
            $table->longText('about')->nullable();
            $table->string('slug')->unique()->nullable();
            $table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete()->cascadeOnUpdate();
            $table->foreignId('level_of_experience_id')->nullable()->constrained()->onUpdate('cascade')->nullOnDelete();
            $table->double('daily_rate');
            $table->foreignId('category_id');
            $table->double('monthly_rate');
            $table->double('yearly_rate');
            $table->string('engineering_licence_number')->unique()->nullable();
            $table->string('engineering_licence_path')->nullable();
            $table->string('engineering_degree_path')->nullable();
            $table->string('passport_path')->nullable();
            $table->string('cv_path')->nullable();
            $table->timestamp('verified_at')->nullable();
            $table->softDeletes();
        });
    }

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