<?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('contact_messages', function (Blueprint $table) {
            // Which triage queue this message belongs to (set by FindRelatedDsarJob)
            // dsar_evidence | dsar_needs_research | unknown | null (not triaged)
            $table->string('triage_queue', 32)->nullable()->after('classification_notes')->index();

            // Staff workflow status within the triage queue
            // pending | in_progress | actioned | dismissed
            $table->string('triage_status', 16)->nullable()->after('triage_queue')->index();
        });
    }

    public function down(): void
    {
        Schema::table('contact_messages', function (Blueprint $table) {
            $table->dropIndex(['triage_queue']);
            $table->dropIndex(['triage_status']);
            $table->dropColumn(['triage_queue', 'triage_status']);
        });
    }
};
