<?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;

/** Код-согласие на вход поддержки в кабинет клиента (G7-B / Ю-1). */
final class ImpersonationCodeMail 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.impersonation_code', with: ['code' => $this->code]);
    }
}
