<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * Add the triage outcome statuses:
     *   - further info required : the institution has asked us to confirm/supply
     *                             more detail before it can locate/release records.
     *   - no records            : the institution holds nothing about the subject (terminal).
     *   - relevant / not relevant : manual relevance disposition (automation comes later).
     */
    public function up(): void
    {
        DB::statement("ALTER TABLE dsars MODIFY COLUMN status ENUM(
            'draft',
            'approved',
            'needs posting',
            'failed',
            'sent',
            'completed',
            'acknowledged',
            'clarified',
            'further info required',
            'no records',
            'relevant',
            'not relevant'
        ) NOT NULL DEFAULT 'draft'");
    }

    public function down(): void
    {
        // Forward-only: any row already holding one of the new values would be
        // coerced by MySQL when the column is narrowed back.
        DB::statement("ALTER TABLE dsars MODIFY COLUMN status ENUM(
            'draft',
            'approved',
            'needs posting',
            'failed',
            'sent',
            'completed',
            'acknowledged',
            'clarified'
        ) NOT NULL DEFAULT 'draft'");
    }
};
