<?php
namespace Eform\Instruction\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Eform\Instruction\Events\InstructionCategoryAction as InstructionCategoryActionEvent;
use Eform\Instruction\Models\InstructionCategory;

class InstructionCategoryAction extends Notification implements ShouldQueue
{
    use Queueable;

    protected $event;
    protected $instruction_category;
    protected $action;
    protected $request;

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

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