<?php
namespace Bixo\CrossTrade\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Bixo\CrossTrade\Events\OrderVehicleAction as OrderVehicleActionEvent;
use Bixo\CrossTrade\Models\OrderVehicle;

class OrderVehicleAction extends Notification implements ShouldQueue
{
    use Queueable;

    protected $event;
    protected $order_vehicle;
    protected $action;
    protected $request;

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

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