<?php

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

/**
 * Seeded, platform-wide currency reference data (see ReferenceDataSeeder) —
 * global like `provinces`/`districts`/`cities`, never tenant-scoped. Backs
 * the Master Control "Locale" tab's currency Select, so a landlord picks
 * from a real list instead of typing a code and a symbol by hand.
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::create('currencies', function (Blueprint $table) {
            $table->id();
            $table->string('code', 3)->unique();
            $table->string('name', 100);
            $table->string('symbol', 10);
            $table->unsignedTinyInteger('decimal_digits')->default(2);
            $table->unsignedInteger('sort_order')->default(0);
            $table->timestamps();
        });
    }

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