<?php

declare(strict_types=1);

namespace App\Mail;

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

/**
 * Письмо в техподдержку о новой заявке клиента (G7-A). Адресат — config('services.support.email').
 */
class SupportRequestMail extends Mailable
{
    use Queueable;
    use SerializesModels;

    public function __construct(public SupportRequest $request) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Лидерра. Заявка в поддержку #'.$this->request->id,
        );
    }

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