<?php

namespace App\Notifications;

use App\Models\Order;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;

class NewOrderNotification extends Notification
{
    use Queueable;

    public function __construct(
        protected Order $order
    ) {}

    public function via(object $notifiable): array
    {
        return ['database'];
    }

    public function toDatabase(object $notifiable): array
    {
        return [
            'title' => 'طلب جديد #' . $this->order->id,
            'body' => "قام التاجر {$this->order->user->name} بعمل طلب جديد بقيمة " . number_format($this->order->total, 2) . ' ج.م',
            'icon' => 'heroicon-o-shopping-cart',
            'iconColor' => 'success',
            'order_id' => $this->order->id,
        ];
    }
}
