import { get, post } from "./serviceHelper";
export const notificationEventTypes = {
    itemChanged: "item-changed",
    feedback: "feedback",
    reviewInvitation: "review-invitation",
    reviewCompleted: "review-completed",
    reviewRejected: "review-rejected",
    taskAssigned: "task-assigned",
    taskStatusChanged: "task-status-changed",
    projectAttentionRequired: "project-attention-required",
    projectTaskCompleted: "project-task-completed",
    projectFinished: "project-finished",
    agentNotification: "agent-notification",
};
export function getDefaultNotificationEventTypes(targetType) {
    switch (targetType) {
        case "item":
            return [notificationEventTypes.itemChanged, notificationEventTypes.feedback];
        case "review":
            return [
                notificationEventTypes.reviewInvitation,
                notificationEventTypes.reviewCompleted,
                notificationEventTypes.reviewRejected,
            ];
        case "project":
            return [
                notificationEventTypes.projectAttentionRequired,
                notificationEventTypes.projectTaskCompleted,
                notificationEventTypes.projectFinished,
            ];
        case "agent-run":
            return [notificationEventTypes.agentNotification];
        default:
            return [];
    }
}
const BASE_URL = "/parhelia/notifications";
export function getNotifications(params) {
    const query = new URLSearchParams();
    if (params?.unreadOnly)
        query.set("unreadOnly", "true");
    if (typeof params?.skip === "number")
        query.set("skip", String(params.skip));
    if (typeof params?.take === "number")
        query.set("take", String(params.take));
    const qs = query.toString();
    return get(`${BASE_URL}/get${qs ? `?${qs}` : ""}`);
}
export function getUnreadCount() {
    return get(`${BASE_URL}/unreadCount`);
}
export function markNotificationRead(id) {
    return post(`${BASE_URL}/markRead`, { id });
}
export function markAllNotificationsRead() {
    return post(`${BASE_URL}/readAll`, {});
}
export function getNotificationSubscriptions() {
    return get(`${BASE_URL}/subscriptions`);
}
export function subscribeToNotifications(request) {
    return post(`${BASE_URL}/subscribe`, request);
}
export function unsubscribeFromNotifications(request) {
    return post(`${BASE_URL}/unsubscribe`, request);
}
export function muteNotifications(request) {
    return post(`${BASE_URL}/mute`, request);
}
export function unmuteNotifications(request) {
    return post(`${BASE_URL}/unmute`, request);
}
//# sourceMappingURL=notificationService.js.map