<?php

namespace App\Mail;

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

    public OrderPackage $order;

    /**
     * Create a new message instance.
     */
    public function __construct(OrderPackage $order)
    {
        $this->order = $order;
    }

    /**
     * Get the message envelope.
     */
    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'New Package Order Received'
        );
    }

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

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