import { apiClient } from './client'; export interface Notification { id: string; userId: string; type: 'feeding' | 'sleep' | 'diaper' | 'medication' | 'milestone' | 'family' | 'system' | 'reminder'; title: string; message: string; data?: Record; isRead: boolean; isDismissed: boolean; createdAt: string; readAt?: string | null; dismissedAt?: string | null; } export interface GetNotificationsParams { limit?: number; offset?: number; isRead?: boolean; type?: Notification['type']; } export interface GetNotificationsResponse { notifications: Notification[]; total: number; unreadCount: number; } export const notificationsApi = { /** * Get user notifications with optional filters */ async getNotifications(params?: GetNotificationsParams): Promise { const { data } = await apiClient.get('/notifications', { params }); return data; }, /** * Mark a notification as read */ async markAsRead(notificationId: string): Promise { const { data } = await apiClient.patch(`/notifications/${notificationId}/read`); return data; }, /** * Mark all notifications as read */ async markAllAsRead(): Promise<{ count: number }> { const { data } = await apiClient.patch<{ count: number }>('/notifications/mark-all-read'); return data; }, /** * Dismiss a notification */ async dismiss(notificationId: string): Promise { const { data } = await apiClient.patch(`/notifications/${notificationId}/dismiss`); return data; }, /** * Get unread notification count */ async getUnreadCount(): Promise { const { data } = await apiClient.get('/notifications', { params: { limit: 1, isRead: false }, }); return data.unreadCount; }, };