<?php

namespace App\Repositories\Core\User\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Auth;

class NewUser extends Notification
{
    use Queueable;

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

    public function toMail($notifiable)
    {
        $currentUser = Auth::user();

        return (new MailMessage())
            ->markdown('notifications.email')
            ->greeting(__('notifications.greeting', ['firstname' => $notifiable->first_name]))
            ->subject(__('notifications.newuser.subject', ['name' => config('app.name')]))
            ->line(
                __('notifications.newuser.intro', [
                    'name' => $currentUser->first_name.' '.$currentUser->last_name,
                ])
            )
            ->action(
                __('notifications.newuser.button'),
                route('users.firstlogin', $notifiable->remember_token)
            )
            ->salutation(
                __('notifications.salutation', [
                    'name' => $currentUser->first_name.' '.$currentUser->last_name,
                ])
            )
            ->line(__('notifications.newuser.outro'));
    }

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