<?php

namespace App\Notifications;

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

class ReplyComment extends Notification implements ShouldQueue
{
    use Queueable;

    public $comment;
    public $reply;

    public function __construct($comment, $reply)
    {
        $this->comment = $comment;
        $this->reply = $reply;
    }

    public function via($notifiable)
    {
        return ['mail'];
    }

    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->greeting('Hello ' . $this->comment->name . ',')
            ->line($this->reply->name . ' replied to your comment:')
            ->line('Your Comment: ' . $this->comment->content)
            ->line('Reply: ' . $this->reply->content)
            ->action('View Reply', url('/post/' . $this->reply->post->slug))
            ->line('Thank you for engaging in the discussion!');
    }

    public function toArray($notifiable)
    {
        return [];
    }
}
