import type { Notification } from "@/lib/types" import { httpJson } from "./http" type Paginated = { items: T[] meta: { total: number offset: number limit: number } } export async function listNotifications(input?: { offset?: number limit?: number }): Promise { const offset = input?.offset ?? 0 const limit = input?.limit ?? 50 const searchParams = new URLSearchParams({ offset: String(offset), limit: String(limit), }) const res = await httpJson>(`/api/v1/notifications?${searchParams}`, { cache: "no-store", }) return res.items } export async function markNotificationAsRead(notificationId: string): Promise { await httpJson(`/api/v1/notifications/${encodeURIComponent(notificationId)}/read`, { method: "PUT", cache: "no-store", }) } export async function markAllNotificationsAsRead(): Promise { await httpJson("/api/v1/notifications/read-all", { method: "PUT", cache: "no-store", }) }