<?php

namespace App\Mail\Applications;

use App\Models\Applications\Application;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

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

    public Application $application;
    public User $recipient;
    public string $status;

    public function __construct(Application $application, User $recipient, $status) {
        $this->application = $application;
        $this->recipient = $recipient;
        $this->status = $status;
    }

    public function build(): NotifyApplicationStatusChanged {
        $subject = $this->application->title;
        return $this->subject($subject)->view("mail.applications.status-changed");
    }
}
