<?php

declare(strict_types=1);

namespace App\Mail;

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

/**
 * Письмо с 6-значным кодом подтверждения почты при самозаписи (G1/SP1).
 */
final class EmailVerificationCodeMail extends Mailable
{
    use Queueable;
    use SerializesModels;

    public function __construct(
        public readonly string $code,
        public readonly string $email,
    ) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Код подтверждения регистрации в Лидерре',
            to: [$this->email],
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'emails.email_verification_code',
            with: ['code' => $this->code],
        );
    }
}
