<?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::table('payment_methods', function (Blueprint $table) {
            // Admin-defined extra checkout inputs for tenant-created custom
            // methods — [{key, label, type, required, options?}]. Null/empty
            // for the built-in codes (cash/card/bank_transfer/cheque/credit/
            // other), whose fields stay hardcoded in the checkout flow.
            $table->json('fields')->nullable()->after('requires_cheque_fields');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('payment_methods', function (Blueprint $table) {
            $table->dropColumn('fields');
        });
    }
};
