import { request } from './client'
import type { Notification } from '@/stores/notifications'

export const notificationsApi = {
  list: (unreadOnly = false, limit = 50) =>
    request<{ items: Notification[] }>(
      `/api/v1/notifications?unread=${unreadOnly}&limit=${limit}`,
    ),
  unreadCount: () =>
    request<{ count: number }>('/api/v1/notifications/unread-count'),
  markRead: (id: string) =>
    request<void>(`/api/v1/notifications/${id}/read`, { method: 'PATCH' }),
  markAllRead: () =>
    request<void>('/api/v1/notifications/read-all', { method: 'PATCH' }),
}
