<?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('trading_partners', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('tenant_id');
            $table->string('name', 100);
            $table->string('type', 20)->default('vendor');
            $table->string('category', 50)->default('기타');
            $table->string('biz_no', 20)->nullable();
            $table->string('bank_account', 100)->nullable();
            $table->string('contact', 50)->nullable();
            $table->string('email', 100)->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', 'type']);
        });
    }

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