'use server';
import { resolve } from '../../lib/server-container.js';
export async function listNotifications(input) {
    try {
        const useCase = resolve('ListNotificationsUseCase');
        const result = await useCase.execute(input);
        return { notifications: result.notifications, unreadCount: result.unreadCount };
    }
    catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to list notifications';
        return { error: message };
    }
}
export async function markNotificationRead(notificationId) {
    try {
        const useCase = resolve('MarkNotificationReadUseCase');
        const result = await useCase.execute({ notificationId });
        if (!result.ok)
            return { error: result.error };
        return {};
    }
    catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to mark notification as read';
        return { error: message };
    }
}
export async function markAllNotificationsRead(recipientId, projectId) {
    try {
        const useCase = resolve('MarkNotificationReadUseCase');
        const result = await useCase.execute({ recipientId, markAll: true, projectId });
        if (!result.ok)
            return { error: result.error };
        return {};
    }
    catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to mark all notifications as read';
        return { error: message };
    }
}
