<?php

namespace App\Modules\Wallet\Listeners;

use App\Modules\Wallet\Events\WalletFunded;
use App\Modules\Notifications\Jobs\SendNotification;

class SendWalletFundedNotification
{
    public function handle(WalletFunded $event): void
    {
        $wallet = $event->wallet;

        SendNotification::dispatch(
            $wallet->user_id,
            'wallet.funded',
            'Wallet Funded',
            "Your wallet has been credited with ₦" . number_format($event->transaction->amount, 2) . ". New balance: ₦" . number_format($wallet->balance, 2),
            'database',
            'normal',
            ['amount' => $event->transaction->amount, 'balance' => $wallet->balance]
        );
    }
}
