<?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('ticket_statuses', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('slug')->unique();
            $table->string('color', 7)->default('#6c757d'); // Bootstrap renkleri için hex kod
            $table->boolean('is_closed')->default(false); // Ticket'ı kapalı olarak sayar mı?
            $table->boolean('is_default')->default(false); // Varsayılan durum mu?
            $table->boolean('is_system')->default(false);
            $table->enum('scope', ['pending', 'open', 'closed'])->default('open');
            $table->integer('sort_order')->default(0);
            $table->boolean('status')->default(true);
            $table->timestamps();

            $table->index(['status', 'sort_order']);
        });
    }

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