<?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\OfferUsVehicleAction as OfferUsVehicleActionEvent;
use Bixo\CrossTrade\Models\OfferUsVehicle;

class OfferUsVehicleAction extends Notification implements ShouldQueue
{
    use Queueable;

    protected $event;
    protected $offer_us_vehicle;
    protected $action;
    protected $request;

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

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