<?php

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;

class ContactFormMail extends Mailable
{
    use Queueable, SerializesModels;

    public readonly string $mailSubject;

    public function __construct(
        public readonly string $senderName,
        public readonly string $senderEmail,
        string $subject,
        public readonly string $body,
        public readonly string $phone = '',
        public readonly string $business = '',
    ) {
        $this->mailSubject = $subject;
    }

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: '[Contact] ' . $this->mailSubject . ' — ' . $this->senderName,
            replyTo: [$this->senderEmail],
        );
    }

    public function content(): Content
    {
        return new Content(view: 'emails.contact-form');
    }
}
