<?php

declare(strict_types=1);

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class EmailChangedSecurityAlertMail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public int $tries = 3;

    public function __construct(public readonly string $newEmail)
    {
        $this->onQueue('mail');
    }

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Your Skinbase email address was changed',
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'emails.email-changed-security-alert',
            with: [
                'newEmail' => $this->newEmail,
                'supportEmail' => (string) config('mail.from.address', 'support@skinbase.org'),
            ],
        );
    }

    public function attachments(): array
    {
        return [];
    }
}
