<?php

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('experts', function (Blueprint $table) {
            $table->id();
            
            $table->foreignId('user_id')->constrained('users');
            $table->string('brand_name')->nullable();
            $table->string('work_email')->nullable();
            $table->string('work_phone')->nullable();
            $table->string('main_category')->nullable();
            $table->string('sub_category')->nullable();
            $table->string('species_type')->nullable();
            $table->json('products')->nullable();
            $table->foreignId('work_province_id')->nullable()->constrained('provinces');
            $table->foreignId('work_county_id')->nullable()->constrained('counties');
            $table->text('work_address')->nullable();
            $table->string('work_postal_code')->nullable();
            $table->decimal('work_latitude', 10, 8)->nullable();
            $table->decimal('work_longitude', 11, 8)->nullable();
            $table->json('business_license')->nullable();
            $table->json('education_certificates')->nullable();
            $table->json('skill_certificates')->nullable();
            $table->json('work_experience')->nullable();

            $table->foreignId('created_by')->constrained('users');
            $table->foreignId('updated_by')->nullable()->constrained('users');
            $table->softDeletes();
            $table->timestamps();
        });
    }

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