<?php

namespace App\Notifications;

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

class NewRequestSubmittedNotification extends Notification
{
    use Queueable;

    public MarketingRequest $request;

    public function __construct(MarketingRequest $request)
    {
        $this->request = $request;
    }

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

    public function toArray(object $notifiable): array
    {
        return [
            'request_id' => $this->request->id,
            'request_number' => $this->request->request_number,
            'title' => 'New Request Submitted',
            'message' => "Request {$this->request->request_number} ({$this->request->requestType->name}) submitted by {$this->request->submitter->name}.",
            'url' => route('requests.show', $this->request->id),
            'type' => 'new_request',
        ];
    }
}
