<?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('statuses', function (Blueprint $table) {
            $table->id();
            $table->string('context', 50);
            $table->string('code', 50);
            $table->string('name', 100);
            $table->string('color', 30)->nullable();
            $table->unsignedSmallInteger('sort_order')->default(0);
            $table->boolean('is_active')->default(true);
            $table->timestamps();
            $table->unique(['context', 'code']);
            $table->index(['context', 'is_active']);
        });
    }

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