import type { NotificationActionError, NotificationCategories, NotificationCounts, NotificationEntry, NotificationMarkAllScope } from "./NotificationSourceProps"; import type { LiveNotificationEntry, NotificationDecision, NotificationReasonRequest, NotificationRowStatus, NotificationZoneLists } from "./NotificationEngineProps"; export type ById = { [id: string]: T | undefined; }; export type WindowPhase = "undo" | "sending" | "settled"; export type DecisionPhase = Exclude; export interface DecisionRecord { batch: string; decision: NotificationDecision; phase: DecisionPhase; folded: boolean; error?: NotificationActionError; settledAt?: number; } export interface FlagRecord { batch: string; value: boolean; phase: WindowPhase; folded: boolean; settledAt?: number; previous?: FlagRecord; } export interface MarkAllRecord { batch: string; scope: NotificationMarkAllScope; phase: WindowPhase; settledAt?: number; } export interface DismissedRecord { actionId: string; settledAt?: number; } export interface NotificationOverlay { decisions: ById; read: ById; archived: ById; markAll: MarkAllRecord[]; reasonRequests: ById; dismissed: ById; epoch: number; } export declare const EMPTY_OVERLAY: NotificationOverlay; export interface DecisionOutcome { batch: string; error?: NotificationActionError; } export type FlagKey = "read" | "archived"; export type OverlayAction = { type: "decide"; batch: string; ids: string[]; decision: NotificationDecision; } | { type: "retry"; batch: string; ids: string[]; } | { type: "fold"; batch: string; } | { type: "send"; batch: string; } | { type: "drop"; batch: string; } | { type: "settleDecisions"; outcomes: Record; } | { type: "dismiss"; id: string; } | { type: "clearReasonRequest"; id: string; } | { type: "flag"; key: FlagKey; batch: string; ids: string[]; value: boolean; phase: "undo" | "sending"; } | { type: "markAll"; batch: string; scope: NotificationMarkAllScope; ids: string[]; } | { type: "settle"; batch: string; } | { type: "reconcile"; entries: NotificationEntry[]; } | { type: "countsChanged"; }; export declare const overlayReducer: (state: NotificationOverlay, action: OverlayAction) => NotificationOverlay; export declare const liveEntryFor: (entry: NotificationEntry, overlay: NotificationOverlay, categories: NotificationCategories) => LiveNotificationEntry; export interface LiveLists { lists: NotificationZoneLists; byId: Map; entries: NotificationEntry[]; } export type LiveCache = WeakMap; export declare const buildLiveLists: (entries: NotificationEntry[], overlay: NotificationOverlay, categories: NotificationCategories, cache?: LiveCache) => LiveLists; export declare const optimisticCounts: (live: LiveLists, overlay: NotificationOverlay, categories: NotificationCategories, server: NotificationCounts) => NotificationCounts;