<?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('users', function (Blueprint $table) {
            $table->string('transaction_pin')->nullable()->after('password');
            $table->string('virtual_account_number')->nullable()->unique()->after('transaction_pin');
            $table->string('virtual_account_bank')->nullable()->after('virtual_account_number');
            $table->string('virtual_account_reference')->nullable()->after('virtual_account_bank');
            $table->string('account_id')->unique()->nullable()->after('id');
            $table->decimal('balance', 15, 2)->default(0)->after('virtual_account_reference');
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn([
                'transaction_pin',
                'virtual_account_number',
                'virtual_account_bank',
                'virtual_account_reference',
                'account_id', 
                'balance'
            ]);
        });
    }
};