<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    public function up(): void
    {
        Schema::create('customers', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('tenant_id');
            $table->string('name', 100);
            $table->string('biz_no', 20)->nullable();
            $table->string('ceo', 50)->nullable();
            $table->string('industry', 50)->nullable();
            $table->string('grade', 20)->default('Silver');
            $table->string('contact', 50)->nullable();
            $table->string('email', 100)->nullable();
            $table->string('address', 200)->nullable();
            $table->string('manager', 50)->nullable();
            $table->string('manager_phone', 20)->nullable();
            $table->string('status', 20)->default('active');
            $table->text('memo')->nullable();
            $table->timestamps();
            $table->softDeletes();
            $table->index(['tenant_id', 'status']);
            $table->index(['tenant_id', 'grade']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('customers');
    }
};
