<?php

namespace App\Mail;

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

    public OrderProduct $order;

    public function __construct(OrderProduct $order)
    {
        $this->order = $order;
    }

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'New Product Order Received'
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'emails.product.admin',
            with: [
                'order'   => $this->order,
                'user'    => $this->order->user,
                'product' => $this->order->product,
            ],
        );
    }

    public function attachments(): array
    {
        return [];
    }
}
