<?php
namespace Bixo\Aml\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Bixo\Aml\Events\NationalityAction as NationalityActionEvent;
use Bixo\Aml\Models\Nationality;

class NationalityAction extends Notification implements ShouldQueue
{
    use Queueable;

    protected $event;
    protected $nationality;
    protected $action;
    protected $request;

    /**
     * Create a new notification instance.
     *
     * @param NationalityActionEvent $nationality
     */
    public function __construct(NationalityActionEvent $nationality)
    {
        $this->action = $event->action;
        $this->nationality = $nationality;
        $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('Nationality Approved - ' . config('app.name'))
            ->view('aml::nationality.email.action', ['data' => $this->nationality]);
    }

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