<?php

namespace App\Notifications;

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

class NewUserNotification extends Notification
{

    public $notificationParam;

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

    }

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

    public function toMail($notificationReceiver)
    {

        $notificationParam = $this->notificationParam;

        $MailMessage = (new MailMessage)
            ->subject('Extranetwork New User')
            ->from(config('mail.from.address'), config('mail.from.name'))
            ->greeting('Extranetwork App New User')
            ->line(new HtmlString('<br><b>Name Surname:</b> '.$notificationParam['name'].' '.$notificationParam['surname']))
            ->line(new HtmlString('<b>Property Name:</b> '.$notificationParam['property_name']))
            ->line(new HtmlString('<b>E-Mail:</b> '.$notificationParam['email']))
            ->line(new HtmlString('<b>Phone:</b> '.$notificationParam['phone']))
            ->line(new HtmlString('<b>Language:</b> '.$notificationParam['language']))
            ->line(new HtmlString('<b>Time:</b> '. Carbon::now()->format('d.m.Y H:i:s')));

        //echo $MailMessage->render(); die();

        return $MailMessage;
    }


}
