<?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('accurate_code_mappings', function (Blueprint $table) {
            $table->id();
            $table->enum('entity_type', ['product', 'customer', 'supplier']);
            $table->string('source_code', 100);
            $table->string('source_label')->nullable();
            $table->string('accurate_code', 100);
            $table->string('accurate_name')->nullable();
            $table->string('notes')->nullable();
            $table->timestamps();

            $table->unique(['entity_type', 'source_code']);
        });
    }

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