import { RefObject } from 'react';
import { SlackMessage, SlackOlderPage, SlackThreadGroup } from '../types/wire';
/**
 * Older-page pagination state for a scrollable list (messages in thread mode,
 * thread-roots in channel mode).
 *
 * Reconciles the live, polled "page 0" window (owned by a useQuery upstream)
 * with on-demand older history: page 0 stays cheap on the 5s poll, while
 * older pages are fetched imperatively here and held in session-local state
 * that is NEVER re-polled (frozen history). The render layer merges
 * `olderItems` with the polled window, deduping by `getKey`.
 *
 * The first older fetch seeds its cursor from page 0's `nextCursor`
 * (`seedCursor`); each subsequent fetch walks back via the previous page's
 * cursor. Scroll position is preserved across prepends so the viewport
 * stays anchored on the same row.
 */
interface UseOlderArgs {
    /** Fetch one older page given the cursor (before_ts) and page-size hint. */
    fetchPage: (beforeTs: string, pageSize?: number) => Promise<SlackOlderPage>;
    /** Page-0 cursor (oldest ts of the live window) — seeds the first fetch. */
    seedCursor?: string | null;
    /** Page-0 page-size hint, forwarded to the server. */
    seedPageSize?: number;
    /** Scroll container; used to preserve scroll position across prepend. */
    scrollRef: RefObject<HTMLElement | null>;
    /** Clears accumulated older pages when it changes (e.g. conv/thread id). */
    resetKey: string;
    /** Fired once per SUCCESSFUL older-page fetch (not per scroll event). */
    onLoaded?: () => void;
}
export interface UseOlderMessagesResult {
    olderMessages: SlackMessage[];
    loadOlder: () => void;
    isLoadingOlder: boolean;
    olderError: boolean;
    canLoadOlder: boolean;
}
/** Thread mode: accumulate older messages (dedup by externalMessageId). */
export declare function useOlderMessages(args: UseOlderArgs): UseOlderMessagesResult;
export interface UseOlderThreadsResult {
    olderThreads: SlackThreadGroup[];
    loadOlder: () => void;
    isLoadingOlder: boolean;
    olderError: boolean;
    canLoadOlder: boolean;
}
/** Channel mode: accumulate older thread-roots (dedup by rootTs). */
export declare function useOlderThreads(args: UseOlderArgs): UseOlderThreadsResult;
export {};
//# sourceMappingURL=useOlderMessages.d.ts.map