interface SearchResponse<ResultT, PageT> {
    /**
     * The search result
     */
    result: ResultT[];
    /**
     * The next page information or null if no more pages are available
     */
    nextPage: PageT | null;
}
/**
 * The search function signature.
 * @param payload The search payload
 * @param page The information for the page to fetch. Use null to fetch the first page
 * @param pageSize The number of items per page
 * @returns A promise that resolves to the search response
 */
type SearchFn<PayloadT, ResultT, PageT = number> = (payload: PayloadT, page: PageT | null, pageSize: number) => Promise<SearchResponse<ResultT, PageT>>;
interface ScrollableSearchOptions<ResultT, PayloadT, PageT = number> {
    /**
     * the search function
     */
    search: SearchFn<PayloadT, ResultT, PageT>;
    /**
     * Initial paylload for the first search
     */
    payload: PayloadT;
    /**
     * Which page size to use. Defaults to 50.
     */
    pageSize?: number;
    /**
     * A ref to the element that triggers loading the next page when it enters the viewport
     */
    nextPageTrigger: React.RefObject<HTMLElement | null>;
}
interface ScrollableSearchResult<ResultT, PayloadT, PageT = number> {
    /**
     * Initiates a new search with the given payload
     * @param payload The search payload
     */
    search: (payload: PayloadT) => void;
    /**
     * Refreshes the current search with the last used payload
     */
    refresh: () => void;
    /**
     * Loads the next page of results
     */
    searchMore: () => void;
    /**
     * The current accumulated search result
     */
    result: ResultT[];
    /**
     * The current page information
     */
    page: PageT | null;
    /**
     * Whether there are more pages to load
     */
    hasMore: boolean;
    /**
     * Any error that occurred during the last search
     */
    error: Error | null;
    /**
     * Whether a search is currently in progress
     */
    isSearching: boolean;
}
/**
 * A hook that provides paginated search functionality with infinite scrolling support.
 */
export declare function useScrollableSearch<ResultT, PayloadT, PageT = number>(opts: ScrollableSearchOptions<ResultT, PayloadT, PageT>, dependencies?: any[]): ScrollableSearchResult<ResultT, PayloadT, PageT>;
type DefaultSearchFn<PayloadT, ResultT> = (payload: PayloadT, offset: number, limit: number) => Promise<ResultT[]>;
interface DefaultScrollableSearchOptions<ResultT, PayloadT> extends Omit<ScrollableSearchOptions<ResultT, PayloadT, number>, 'search'> {
    search: DefaultSearchFn<PayloadT, ResultT>;
}
export declare function useDefaultScrollableSearch<ResultT, PayloadT>(opts: DefaultScrollableSearchOptions<ResultT, PayloadT>, dependencies?: any[]): ScrollableSearchResult<ResultT, PayloadT, number>;
export {};
//# sourceMappingURL=useScrollableSearch.d.ts.map