<?php

namespace App\Mail;

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;
use App\Models\OfflinePayment;
use App\Models\Booking;

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

    public $offlinePayment;
    public $booking;

    /**
     * Create a new message instance.
     */
    public function __construct(OfflinePayment $offlinePayment, Booking $booking)
    {
        $this->offlinePayment = $offlinePayment;
        $this->booking = $booking;
    }

    /**
     * Get the message envelope.
     */
    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Payment Approved! Booking Confirmed - ' . $this->booking->booking_reference,
        );
    }

    /**
     * Get the message content definition.
     */
    public function content(): Content
    {
        return new Content(
            view: 'emails.offline_payment_approved',
            with: [
                'offlinePayment' => $this->offlinePayment,
                'booking' => $this->booking,
                'package' => $this->booking->package,
            ]
        );
    }

    /**
     * Get the attachments for the message.
     */
    public function attachments(): array
    {
        return [];
    }
}
