/**
 * Notifications REST client — typed wrapper around the slice-6 endpoints
 * (`/notifications`, `/notifications/unread-count`,
 * `/notifications/:id/read`, `/notifications/read-all`).
 *
 * Lives in `cms-admin` so the bell, the toast layer, and any future
 * background sync agent share one request path, error model, and DTO
 * shape. The wire format mirrors `NotificationDTO` in
 * `@actuate-media/cms-core/realtime/notifications.ts`; we duplicate the
 * shape here to avoid taking a hard dependency on the server module
 * (which carries Prisma types that don't belong in the admin bundle).
 */
export type NotificationKind = 'comment_reply' | 'comment_resolved' | 'comment_mention';
export interface CommentReplyPayload {
    kind: 'comment_reply';
    actorId: string | null;
    actorName: string | null;
    excerpt: string;
}
export interface CommentResolvedPayload {
    kind: 'comment_resolved';
    actorId: string | null;
    actorName: string | null;
    rootExcerpt: string;
}
export interface CommentMentionPayload {
    kind: 'comment_mention';
    actorId: string | null;
    actorName: string | null;
    excerpt: string;
}
export type NotificationPayload = CommentReplyPayload | CommentResolvedPayload | CommentMentionPayload;
export interface Notification {
    id: string;
    userId: string;
    kind: NotificationKind;
    documentId: string | null;
    commentId: string | null;
    payload: NotificationPayload;
    readAt: string | null;
    createdAt: string;
}
export type NotificationOutcome<T> = {
    ok: true;
    result: T;
} | {
    ok: false;
    error: string;
    status: number;
};
export interface ListNotificationsOptions {
    /** Default: false. When true the response includes already-read rows. */
    includeRead?: boolean;
    /** Default: server-side cap. Hard upper bound is 200. */
    pageSize?: number;
}
export declare function listNotifications(opts?: ListNotificationsOptions): Promise<NotificationOutcome<Notification[]>>;
export declare function unreadCount(): Promise<NotificationOutcome<number>>;
export declare function markNotificationRead(id: string): Promise<NotificationOutcome<Notification>>;
export declare function markAllNotificationsRead(): Promise<NotificationOutcome<number>>;
/**
 * Subscribe to the per-user SSE push channel that ships notifications
 * the instant they're persisted server-side. Replaces the 30-second
 * poll loop in the notification bell.
 *
 * The browser's native `EventSource` handles reconnection for us — on
 * a server-initiated close (the stream caps at ~4 minutes by design),
 * the connection re-opens automatically. We DO NOT abort the poll
 * fallback in callers: SSE is a latency-win, the poll is what keeps
 * multi-node deployments correct (each node only pushes to its own
 * subscribers).
 *
 * Returns a `close()` function that callers MUST invoke on unmount —
 * otherwise the browser keeps the connection open and we leak event
 * listeners.
 *
 * `EventSource` itself isn't available in the JSDOM test environment;
 * callers can inject a `factory` to substitute a test double. In
 * production we fall back to the global `EventSource` when no factory
 * is supplied.
 */
export interface NotificationStreamOptions {
    /** Called for every `event: notification` frame. */
    onNotification: (n: Notification) => void;
    /** Called once on the `event: ready` frame. */
    onReady?: (payload: {
        userId: string;
    }) => void;
    /** Called on connection errors. Useful for falling back to the poll loop. */
    onError?: (event: Event) => void;
    /**
     * Optional factory so unit tests can inject a fake `EventSource`,
     * or a null sentinel when the environment lacks one (SSR, JSDOM
     * without a polyfill). Production code can rely on the default
     * (global `EventSource`).
     */
    factory?: (url: string) => EventSourceLike | null;
}
/**
 * Minimal subset of the `EventSource` interface our subscriber relies
 * on. Browsers ship the full DOM type; the admin only needs add/remove
 * event listeners plus `close()`.
 */
export interface EventSourceLike {
    addEventListener: (type: string, listener: (event: MessageEvent | Event) => void) => void;
    removeEventListener?: (type: string, listener: (event: MessageEvent | Event) => void) => void;
    close: () => void;
}
export interface NotificationStreamHandle {
    /** Tear down the EventSource and stop receiving events. Idempotent. */
    close: () => void;
}
export declare function subscribeNotificationStream(opts: NotificationStreamOptions): NotificationStreamHandle;
/**
 * Cheap single-line summary for the bell list — the server gives us a
 * structured payload, but the dropdown wants one human-readable string
 * per row. Falls back to `Notification` when an unknown kind sneaks in
 * (defensive against future server-side additions).
 */
export declare function notificationSummary(notification: Notification): string;
//# sourceMappingURL=notifications-client.d.ts.map