import type { Fetcher } from 'swr' import { get, post } from './base' export type Notification = { id: string type: string title: string content: string sender_id: string sender_name: string dataset_id: string dataset_name: string segment_id: string segment_preview: string link_url: string is_read: boolean created_at: string } export type NotificationListResponse = { notifications: Notification[] unread_count: number total: number } export type UnreadCountResponse = { unread_count: number } export type MarkAsReadRequest = { notification_ids?: string[] mark_all_as_read?: boolean } export const fetchNotifications: Fetcher = (url) => { return get(url) } export const fetchUnreadCount: Fetcher = (url) => { return get(url) } export const markNotificationsAsRead = (data: MarkAsReadRequest) => { return post<{ result: string }>('/datasets/notifications', { body: data }) }