import { NotificationRecord } from '@platform-modules/notifications/inbox';
export { NotificationRecord } from '@platform-modules/notifications/inbox';
import * as react from 'react';
import { ReactNode } from 'react';

/**
 * Injected data seam for the browser. Every method targets the CURRENT user's
 * inbox — the consumer's route derives userId from the session, NEVER a param
 * (a browser-asserted userId would be an IDOR footgun).
 */
interface NotificationClient {
    list(opts?: {
        limit?: number;
        cursor?: string;
        unreadOnly?: boolean;
    }): Promise<{
        items: NotificationRecord[];
        nextCursor?: string;
    }>;
    unreadCount(): Promise<number>;
    markRead(ids: string[] | 'all'): Promise<void>;
}

declare class NotificationClientError extends Error {
    readonly code: string;
    constructor(message: string, code?: string);
}
declare function isNotificationClientError(e: unknown): e is NotificationClientError;

declare function useNotifications(client: NotificationClient, opts?: {
    pollMs?: number;
}): {
    items: NotificationRecord[];
    unread: number;
    loading: boolean;
    error: Error | null;
    hasMore: boolean;
    loadMore: () => Promise<void>;
    markRead: (ids: string[] | "all") => Promise<void>;
    reload: () => void;
};

interface NotificationBellProps {
    client: NotificationClient;
    onOpen?(): void;
}
declare function NotificationBell({ client, onOpen }: NotificationBellProps): react.JSX.Element;

interface NotificationListProps {
    client: NotificationClient;
    emptyState?: ReactNode;
}
declare function NotificationList({ client, emptyState }: NotificationListProps): react.JSX.Element;

export { NotificationBell, type NotificationClient, NotificationClientError, NotificationList, isNotificationClientError, useNotifications };
