<?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 SelfPacedExamUnlockedMail extends Mailable
{
    use Queueable, SerializesModels;

    public function __construct(public Enrollment $enrollment) {}

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

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