import { createContext, useContext } from "react"; export type NotificationSession = { dismissedIds: ReadonlySet; readIds: ReadonlySet; dismiss: (ids: string[]) => void; markRead: (ids: string[]) => void; /** At-risk work orders hidden from the SLA banner for this session. */ slaBannerDismissedIds: ReadonlySet; dismissSlaBanner: (workOrderIds: number[]) => void; /** Returns the ids not toasted yet this session and marks them toasted, so each toast fires once. */ claimSlaToasts: (workOrderIds: number[]) => number[]; }; export const NotificationSessionContext = createContext(null); export function useNotificationSession(): NotificationSession { const session = useContext(NotificationSessionContext); if (!session) { throw new Error("useNotificationSession must be used within a NotificationSessionProvider"); } return session; }