<?php
namespace Eform\Faq\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Eform\Faq\Events\FaqAction as FaqActionEvent;
use Eform\Faq\Models\Faq;

class FaqAction extends Notification implements ShouldQueue
{
    use Queueable;

    protected $event;
    protected $faq;
    protected $action;
    protected $request;

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

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