<?php

declare(strict_types=1);

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class AdminPasswordResetNotification extends Notification
{
    use Queueable;

    public function __construct(public string $newPassword) {}

    /**
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    public function toMail(object $notifiable): MailMessage
    {
        return (new MailMessage)
            ->subject('Your Password Has Been Reset')
            ->line('Your account password has been reset by an administrator.')
            ->line('Your new password is:')
            ->line('**'.$this->newPassword.'**')
            ->line('Please log in and change your password immediately for security purposes.')
            ->action('Log In', config('app.domains.account'));
    }

    /**
     * @return array<string, mixed>
     */
    public function toArray(object $notifiable): array
    {
        return [
            'action' => 'password_reset',
            'message' => 'Your password has been reset by an administrator.',
        ];
    }
}
