import api from './api'; export interface Notification { id: number; user_id: number; title: string; content: string; type: string; is_read: boolean; link?: string; read_at?: string; created_at: string; } export interface NotificationListResponse { success: boolean; data: { notifications: Notification[]; total: number; page: number; limit: number; }; } export interface UnreadCountResponse { success: boolean; data: { count: number; }; } export const notificationService = { getNotifications: (page: number = 1, limit: number = 10, isRead?: boolean) => { const offset = (page - 1) * limit; const params: Record = { offset, limit }; if (isRead !== undefined) { params.is_read = isRead; } return api.get('/notifications', params); }, getUnreadCount: () => { return api.get('/notifications/unread-count'); }, markAsRead: (id: number) => { return api.put<{ success: boolean }>(`/notifications/${id}/read`); }, markAllAsRead: () => { return api.post<{ success: boolean }>('/notifications/read-all'); } };