<?php

namespace App\Notifications;

use Illuminate\Notifications\Notification;

/**
 * Database-channel notification driving the admin topbar bell — replaces
 * the old project's bespoke `document_notifications` table with Laravel's
 * built-in notifications table or User/Customer already has via Notifiable.
 */
class DocumentReviewNeeded extends Notification
{
    public function __construct(
        public readonly string $subjectLabel,
        public readonly string $documentType,
        public readonly string $url,
    ) {}

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

    public function toArray(object $notifiable): array
    {
        return [
            'title' => 'Document awaiting review',
            'message' => "{$this->subjectLabel} uploaded a new ".str($this->documentType)->headline().' document.',
            'url' => $this->url,
        ];
    }
}
