import { api } from '@/lib/api' import type { NotificationPage } from '@/types/notifications' export const notifications = { list: (params?: { unreadOnly?: boolean; page?: number; pageSize?: number }) => api.get('/notifications', { params }).then(r => r.data), unreadCount: () => api.get<{ count: number }>('/notifications/unread-count').then(r => r.data.count), markRead: (id: string) => api.patch(`/notifications/${id}/read`).then(() => undefined), markAllRead: () => api.patch('/notifications/read-all').then(() => undefined), remove: (id: string) => api.delete(`/notifications/${id}`).then(() => undefined), } /** SignalR hub URL — the API base URL without its trailing /api. */ export const NOTIFICATION_HUB_URL = (process.env.NEXT_PUBLIC_API_URL ?? 'http://localhost:5089/api').replace(/\/api\/?$/, '') + '/hubs/notifications'