<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use App\Models\Pesanan;

class KurirDitugaskanNotification extends Notification
{
    use Queueable;

    protected $pesanan;

    /**
     * Create a new notification instance.
     */
    public function __construct(Pesanan $pesanan)
    {
        $this->pesanan = $pesanan;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['database'];
    }

    /**
     * Get the array representation of the notification.
     *
     * @return array<string, mixed>
     */
    public function toArray(object $notifiable): array
    {
        return [
            'pesanan_id' => $this->pesanan->id,
            'no_resi' => $this->pesanan->no_resi ?? '-',
            'alamat' => $this->pesanan->alamat_tujuan ?? '-',
            'pesan' => 'Anda ditugaskan untuk mengirim pesanan #' . $this->pesanan->id,
        ];
    }
}
