<?php

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

/**
 * Add 'callback' to the payment_logs.type enum.
 *
 * MySQL does not support ALTER COLUMN on an ENUM directly via Blueprint,
 * so we use a raw DB statement to modify the column definition.
 */
return new class extends Migration
{
    public function up(): void
    {
        // Modify the enum to include 'callback'
        DB::statement("ALTER TABLE payment_logs MODIFY COLUMN `type` ENUM('collection','disbursement','status_check','test','callback') NOT NULL DEFAULT 'collection' COMMENT 'Type of API operation'");
    }

    public function down(): void
    {
        // Revert to original enum (drops 'callback')
        DB::statement("ALTER TABLE payment_logs MODIFY COLUMN `type` ENUM('collection','disbursement','status_check','test') NOT NULL DEFAULT 'collection' COMMENT 'Type of API operation'");
    }
};
