<?php

namespace App\Mail;

use App\Models\AssistanceApplication;
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 NewAssistanceApplication extends Mailable implements ShouldQueue
{
    use Queueable;
    use SerializesModels;

    public function __construct(public AssistanceApplication $application) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'New Assistance Application Submitted',
        );
    }

    public function content(): Content
    {
        return new Content(
            markdown: 'emails.new-assistance-application',
            with: [
                'application' => $this->application,
                'applicant' => $this->application->user,
                'adminUrl' => url('/admin/assistance-applications/'.$this->application->id.'/edit'),
            ],
        );
    }
}
