<?php

use App\Enums\VerificationStatus;
use App\Models\User;
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('companies', function (Blueprint $table) {
            $table->id();
            $table->foreignIdFor(User::class);
            $table->string('name', 100);
            $table->string('email', 254);
            $table->text('address');
            $table->string('director_name', 100);
            $table->string('director_nik', 16);
            $table->string('deed_incorporation', 100);
            $table->string('trade_license', 100);
            $table->string('tax_id_number', 100);
            $table->string('taxable_enterprise', 100);
            $table->string('annual_tax_return', 100);
            $table->string('domicile_certificate', 100);
            $table->string('profile', 100);
            $table->enum('status', VerificationStatus::cases())->default(VerificationStatus::PENDING)->comment(VerificationStatus::comment());
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
            $table->softDeletes();
        });
    }

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