<?php

namespace App\Mail;

use App\Models\Payment;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class PaymentReceivedMail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public function __construct(public Payment $payment) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: '✓ NSMA — Төлбөр амжилттай (' . $this->payment->tierLabel() . ' захиалга)',
            replyTo: ['info@nsma.mn' => 'NSMA Зөвлөх'],
        );
    }

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