<?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 ImpersonationEndedMail extends Mailable
{
    use Queueable;
    use SerializesModels;

    public function __construct(
        public readonly string $email,
        public readonly ?string $tenantName = null,
    ) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Сессия поддержки в вашем кабинете завершена',
            to: [$this->email],
        );
    }

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