<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class UnsubscribedNotification extends Notification
{
    use Queueable;

    protected $newsletter;

    /**
     * Create a new notification instance.
     */
    public function __construct($newsletter)
    {
        $this->newsletter = $newsletter;
    }

    /**
     * Get the notification's delivery channels.
     */
    public function via($notifiable)
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->subject('You have unsubscribed from our newsletter')
            ->greeting('Hello,')
            ->line('You have successfully unsubscribed from our newsletter.')
            ->line('If this was a mistake, you can re-subscribe anytime.')
            ->action('Resubscribe', url('/subscribe'))
            ->line('Thank you for being with us!');
    }
}