<?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('drivers', function (Blueprint $table) {
            $table->string('bank_name')->nullable();
            $table->string('account_number')->nullable();
            $table->string('account_name')->nullable();
        });

        Schema::table('wallets', function (Blueprint $table) {
            $table->string('paystack_customer_code')->nullable();
            $table->string('paystack_account_number')->nullable();
            $table->string('paystack_bank_name')->nullable();
            $table->string('currency')->default('NGN')->change();
        });

        Schema::table('rides', function (Blueprint $table) {
            $table->enum('payment_method', ['wallet', 'bank_transfer', 'cash'])->default('wallet');
        });
    }

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

        Schema::table('wallets', function (Blueprint $table) {
            $table->dropColumn(['paystack_customer_code', 'paystack_account_number', 'paystack_bank_name']);
        });

        Schema::table('drivers', function (Blueprint $table) {
            $table->dropColumn(['bank_name', 'account_number', 'account_name']);
        });
    }
};
