<?php

namespace App\Notifications;

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

class TicketAssignedNotification extends Notification
{
    use Queueable;

    public function __construct(private readonly Ticket $ticket) {}

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

    public function toArray(object $notifiable): array
    {
        return [
            'title_key' => 'tickets.notifications.assigned.title',
            'body' => $this->ticket->ticket_number.' - '.$this->ticket->title,
            'ticket_id' => $this->ticket->id,
            'url' => route('tickets.show', $this->ticket->id),
        ];
    }
}
