<?php

namespace Modules\MembershipApplication\Emails;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Modules\MembershipApplication\Entities\MembershipApplication;

class MembershipApplicationPassedNotification extends Notification
{
    use Queueable;

    public function __construct(
        protected MembershipApplication $application
    ) {}

    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    public function toMail(object $notifiable): MailMessage
    {
        $this->application->loadMissing('applicant');

        return (new MailMessage)
            ->subject('Permohonan Keahlian Diluluskan')
            ->markdown('membershipapplication::emails.passed', [
                'name' => $this->application->applicant->name,
                'applicationNumber' => $this->application->application_number,
                'logoPath' => public_path('images/logo-kopkb.svg'),
            ]);
    }
}
