<?php
namespace Litematrimony\Profile\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Litematrimony\Profile\Events\ShortlistAction as ShortlistActionEvent;
use Litematrimony\Profile\Models\Shortlist;

class ShortlistAction extends Notification implements ShouldQueue
{
    use Queueable;

    protected $shortlist;

    protected $action;

    /**
     * Create a new notification instance.
     *
     * @param ShortlistActionEvent $shortlist
     * @param string $action
     */
    public function __construct(ShortlistActionEvent $shortlist, string $action)
    {
        $this->action = $action;
        $this->shortlist = $shortlist;
    }

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

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