<?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::table('import_jobs', function (Blueprint $table) {
            // 2 = Cross-fill (mevcut anime, eksik kaynak ekleniyor)
            // 1 = Ongoing güncelleme
            // 0 = Yeni anime keşfi (varsayılan)
            $table->tinyInteger('priority')->default(0)->after('status');
            $table->index(['status', 'priority', 'id']);
        });
    }

    public function down(): void
    {
        Schema::table('import_jobs', function (Blueprint $table) {
            $table->dropColumn('priority');
        });
    }
};
