<?php

namespace App\Mail;

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

class ReplyMail extends Mailable
{
    use Queueable, SerializesModels;

    public function __construct(
        public Contact $contact,
        public string $reply,
    ) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Balasan Tim Dukungan CASHEV - ' . $this->contact->nama,
            from: new Address(config('mail.from.address'), config('mail.from.name')),
            replyTo: [new Address(config('mail.support_address'), 'Support CASHEV')],
        );
    }

    public function content(): Content
    {
        return new Content(
            markdown: 'emails.reply',
            with: [
                'nama'  => $this->contact->nama,
                'usaha' => $this->contact->usaha,
                'pesan' => $this->contact->pesan,
                'reply' => $this->reply,
            ],
        );
    }
}