<?php

namespace App\Mail;

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

class ApprovalDecisionMail extends Mailable
{
    use Queueable, SerializesModels;

    public function __construct(
        public readonly TravelRequest $travelRequest,
    ) {}

    public function envelope(): Envelope
    {
        $status = $this->travelRequest->status->value;
        return new Envelope(
            subject: 'Travel Request #' . $this->travelRequest->id . ' ' . $status,
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'mail.approval-decision',
        );
    }
}
