/** * Application Use Case: GetUnreadNotificationsUseCase * * Retrieves unread notifications for a recipient. */ import type { AsyncUseCase } from '@gridpilot/shared/application'; import type { Notification } from '../../domain/entities/Notification'; import type { INotificationRepository } from '../../domain/repositories/INotificationRepository'; export interface UnreadNotificationsResult { notifications: Notification[]; totalCount: number; } export class GetUnreadNotificationsUseCase implements AsyncUseCase { constructor( private readonly notificationRepository: INotificationRepository, ) {} async execute(recipientId: string): Promise { const notifications = await this.notificationRepository.findUnreadByRecipientId(recipientId); return { notifications, totalCount: notifications.length, }; } } /** * Additional notification query/use case types (e.g., listing or counting notifications) * can be added here in the future as needed. */