<?php

namespace App\Mail\SelfPaced;

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

class SelfPacedPaymentReceiptMail extends Mailable
{
    use Queueable, SerializesModels;

    public function __construct(
        public Enrollment $enrollment,
        public array $paymentDetails
    ) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Payment Receipt — ' . $this->enrollment->course->title,
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'emails.self-paced.payment-receipt',
            with: [
                'enrollment' => $this->enrollment,
                'course' => $this->enrollment->course,
                'learner' => $this->enrollment->user,
                'paymentDetails' => $this->paymentDetails,
            ],
        );
    }
}
