<?php

namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use NotificationChannels\WebPush\WebPushMessage;
use NotificationChannels\WebPush\WebPushChannel;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class AssignedTask extends Notification
{

protected $notificationData;

public function __construct($notificationData){
    $this->notificationData = $notificationData;
}

    use Queueable;
    
    public function via($notifiable)
    {
        return [WebPushChannel::class];
    }

    public function toWebPush($notifiable, $notification)
    {
        return (new WebPushMessage)
            ->title($this->notificationData['title'])
            ->icon('img/logos/halogo.png')
            ->body($this->notificationData['text'])
            ->action('Open HAcockpit', 'open_cockpit')
            ->data(['url' => route('backups')]);
    }
    
}