import { api } from "@/lib/api-client"; import type { Notification, NotificationRule, NotificationPreferences, NotificationRuleCreateRequest, } from "@/types/notification"; import type { ApiSuccessResponse, PaginatedResponse, PaginationParams } from "@/types"; export const notificationService = { async listNotifications( params?: PaginationParams & { type?: string; is_read?: boolean }, ): Promise> { return api.get>( "/notifications", params as Record, ); }, async markNotificationRead(id: number): Promise { return api.post(`/notifications/${id}/read`); }, async markAllNotificationsRead(): Promise { return api.post("/notifications/read-all"); }, async getUnreadNotificationCount(): Promise<{ count: number }> { return api.get<{ count: number }>("/notifications/unread-count"); }, async listNotificationRules(): Promise { return api.get("/notification-rules"); }, async createNotificationRule(data: NotificationRuleCreateRequest): Promise { return api.post("/notification-rules", data); }, async updateNotificationRule(id: number, data: Partial): Promise { return api.patch(`/notification-rules/${id}`, data); }, async deleteNotificationRule(id: number): Promise { return api.delete(`/notification-rules/${id}`); }, async getNotificationPreferences(): Promise { return api.get("/notification-preferences"); }, async updateNotificationPreferences(data: Partial): Promise { return api.patch("/notification-preferences", data); }, };