<?php
namespace Bixo\Account\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Bixo\Account\Events\BankAction as BankActionEvent;
use Bixo\Account\Models\Bank;

class BankAction extends Notification implements ShouldQueue
{
    use Queueable;

    protected $event;
    protected $bank;
    protected $action;
    protected $request;

    /**
     * Create a new notification instance.
     *
     * @param BankActionEvent $bank
     */
    public function __construct(BankActionEvent $bank)
    {
        $this->action = $event->action;
        $this->bank = $bank;
        $this->request = $event->request;
        $this->event = $event;

    }

    /**
     * Get the mail representation of the notification.
     *
     * @param mixed $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->subject('Bank Approved - ' . config('app.name'))
            ->view('account::bank.email.action', ['data' => $this->bank]);
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param object $notifiable
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['mail'];
    }
}