<?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('biz_cert', function (Blueprint $table) {
            $table->id();
            $table->string('biz_no', 12)->comment('사업자등록번호');
            $table->string('company_name', 100)->comment('상호');
            $table->string('representative', 50)->nullable()->comment('대표자');
            $table->date('open_date')->nullable()->comment('개업일');
            $table->string('address', 255)->nullable()->comment('주소');
            $table->string('biz_type', 100)->nullable()->comment('업태');
            $table->string('biz_item', 255)->nullable()->comment('종목');
            $table->date('issue_date')->nullable()->comment('발급일');
            $table->text('raw_text')->nullable()->comment('OCR 원본 텍스트');
            $table->string('ocr_method', 20)->default('claude')->comment('OCR 방식 (tesseract/claude)');
            $table->timestamps();

            $table->index('biz_no');
            $table->index('company_name');
        });
    }

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