<?php

namespace App\Mail;

use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class TemplateMail extends Mailable
{
    use SerializesModels;

    public function __construct(
        public string $subjectText,
        public string $viewName,
        public array $payload = []
    ) {}

    public function build()
    {
        return $this->subject($this->subjectText)
            ->view($this->viewName, $this->payload);
    }
}
