import { apiClient } from "./client"; export interface NotificationItem { id: string; user_id: string; category: string; severity: "info" | "warning" | "error" | "success"; title: string; message: string | null; source_type: string | null; source_id: string | null; metadata: Record; read_at: string | null; dismissed_at: string | null; created_at: string; } export interface NotificationListResponse { items: NotificationItem[]; total: number; limit: number; offset: number; } export interface UnreadCountResponse { count: number; } export interface MarkAllReadResponse { marked_count: number; } export interface ClearAllResponse { cleared_count: number; } export const getNotifications = async (): Promise => { const response = await apiClient.get("/notifications"); return response.data; }; export const getUnreadCount = async (): Promise => { const response = await apiClient.get( "/notifications/unread", ); return response.data.count; }; export const markNotificationRead = async ( id: string, ): Promise => { const response = await apiClient.patch( `/notifications/${id}/read`, ); return response.data; }; export const markAllNotificationsRead = async (): Promise => { const response = await apiClient.post( "/notifications/mark-all-read", ); return response.data.marked_count; }; export const dismissNotification = async (id: string): Promise => { await apiClient.delete(`/notifications/${id}`); }; export const clearAllNotifications = async (): Promise => { const response = await apiClient.delete("/notifications"); return response.data.cleared_count; };