<?php

declare(strict_types=1);
namespace App\Services;
use App\Repositories\NotificationRepository;

final class NotificationService
{
    public function __construct(private ?NotificationRepository $repo=null){$this->repo??=new NotificationRepository();}
    public function latest(int $userId): array{return $this->repo->latest($userId);}
    public function unreadCount(int $userId): int{return $this->repo->unreadCount($userId);}
    public function markRead(int $id,int $userId): void{$this->repo->markRead($id,$userId);}
    public function markAllRead(int $userId): void{$this->repo->markAllRead($userId);}
    public function create(int $userId,string $title,string $message,?string $link=null,string $type='info'): int{return $this->repo->create($userId,$title,$message,$link,$type);}
}
