<?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('firms', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->string('name');
            $table->string('slug')->unique();
            $table->string('email')->unique();
            $table->string('website')->unique()->nullable();
            $table->string('tag_line')->nullable();
            $table->longText('about');
            $table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete()->cascadeOnUpdate();
            $table->foreignId('firm_type_id')->nullable()->constrained()->onUpdate('cascade')->nullOnDelete();
            $table->foreignId('firm_size_id')->nullable()->constrained()->onUpdate('cascade')->nullOnDelete();
            $table->foreignId('category_id')->nullable()->default(1);
            $table->string('commercial_registration_number')->unique()->nullable();
            $table->string('commercial_registration_path')->nullable();
            $table->string('company_profile_path')->nullable();
            $table->string('owner_id_path')->nullable();
            $table->string('contact_person_id_path')->nullable();
            $table->timestamp('verified_at')->nullable();
            $table->softDeletes();
        });
    }

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