<?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('loan_products', function (Blueprint $table): void {
            $table->string('processing_fee_payment_mode', 30)->default('financed')->after('processing_fee_value');
        });

        Schema::table('loans', function (Blueprint $table): void {
            $table->string('processing_fee_payment_mode', 30)->default('financed')->after('processing_fee');
        });
    }

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

        Schema::table('loan_products', function (Blueprint $table): void {
            $table->dropColumn('processing_fee_payment_mode');
        });
    }
};
