<?php

namespace App\Notifications;

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

class AccountAlreadyExists extends Notification implements ShouldQueue
{
    use Queueable;

    /**
     * Create a new notification instance.
     */
    public function __construct() {}

    /**
     * Get the notification's delivery channels.
     *
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     */
    public function toMail(object $notifiable): MailMessage
    {
        $loginUrl = route('login');
        $resetUrl = route('password.request');

        return (new MailMessage)
            ->subject('Account Already Exists on Xeek')
            ->greeting('Hello!')
            ->line('Someone tried to register using this email address, but an account already exists.')
            ->line('If this was you, you can sign in to your existing account:')
            ->action('Sign In', $loginUrl)
            ->line('If you forgot your password, you can reset it here:')
            ->action('Reset Password', $resetUrl)
            ->line('If you did not attempt to register, you can safely ignore this email.');
    }
}
