import type { AsyncThunkAction } from '@reduxjs/toolkit';
import type { Result } from '../../../api/search/search/result.js';
import type { CoreEngine } from '../../../app/engine.js';
import type { ClickAction, CustomAction } from '../../../features/analytics/analytics-utils.js';
import type { CollectionId, FoldedCollection, FoldedResult } from '../../../features/folding/folding-state.js';
import type { Controller } from '../../controller/headless-controller.js';
import { type ResultListOptions } from '../result-list/headless-core-result-list.js';
import type { SearchStatusState } from '../status/headless-core-status.js';
export type { FoldedCollection, FoldedResult };
export interface FoldingOptions {
    /**
     * The name of the field on which to do the folding. The folded result list component will use the values of this field to resolve the collections of result items.
     *
     * @defaultValue `foldingcollection`
     */
    collectionField?: string;
    /**
     * The name of the field that determines whether a certain result is a top result containing other child results within a collection.
     *
     * @defaultValue `foldingparent`
     */
    parentField?: string;
    /**
     * The name of the field that uniquely identifies a result within a collection.
     *
     * @defaultValue `foldingchild`
     */
    childField?: string;
    /**
     * The number of child results to fold under the root collection element, before expansion.
     *
     * @defaultValue `2`
     */
    numberOfFoldedResults?: number;
}
export interface FoldedResultListOptions extends ResultListOptions {
    folding?: FoldingOptions;
}
export interface CoreFoldedResultListProps {
    /**
     * The options for the `FoldedResultList` controller.
     * */
    options?: FoldedResultListOptions;
    /**
     * The action creator to build the `loadCollection` action.
     */
    loadCollectionActionCreator: (collectionId: CollectionId) => AsyncThunkAction<any, CollectionId, any>;
    /**
     * The action creator to build the `fetchMoreResults` action.
     */
    fetchMoreResultsActionCreator: () => AsyncThunkAction<unknown, void, any>;
}
/**
 * The `FoldedResultList` headless controller re-organizes results into hierarchical collections (a.k.a. threads).
 *
 * Example: [folded-result-list.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/folded-result-list/folded-result-list.fn.tsx)
 *
 * @group Controllers
 * @category FoldedResultList
 */
export interface FoldedResultList extends Controller {
    /**
     * The state of the `FoldedResultList` controller.
     */
    state: FoldedResultListState;
    /**
     * Using the same parameters as the last successful query, fetch another batch of results, if available.
     * Particularly useful for infinite scrolling, for example.
     *
     * This method is not compatible with the `Pager` controller.
     */
    fetchMoreResults(): void;
    /**
     * Loads all the folded results for a given collection.
     *
     * @param collection - The collection for which to load more results.
     */
    loadCollection(collection: FoldedCollection): void;
    /**
     * Logs a click event when a user loads/shows more folded results.
     *
     * @param result - The result to send analytics for.
     */
    logShowMoreFoldedResults(result: Result): void;
    /**
     * Logs a custom event when a user shows less folded results.
     *   */
    logShowLessFoldedResults(): void;
    /**
     * Finds a folded result by its unique ID.
     *
     * @param collection - The folded collection whose ID will be used to find a collection in the results.
     * @returns The `FoldedResult` associated with the collection's ID.
     */
    findResultById(collection: FoldedCollection): FoldedResult | null;
    /**
     * Finds a folded result by its collection.
     *
     * @param collection - The folded collection whose collection name will be used to find a collection in the results.
     * @returns The `FoldedResult` associated with the collection's name.
     */
    findResultByCollection(collection: FoldedCollection): FoldedResult | null;
}
/**
 * A scoped and simplified part of the headless state that is relevant to the `FoldedResultList` controller.
 *
 * @group Controllers
 * @category FoldedResultList
 */
export interface FoldedResultListState extends SearchStatusState {
    /**
     * The ordered list of collections.
     * */
    results: FoldedCollection[];
    /**
     * The unique identifier of the response where the results were fetched, this value does not change when loading more results.
     */
    searchResponseId: string;
    /**
     * Whether more results are available, using the same parameters as the last successful query.
     *
     * This property is not compatible with the `Pager` controller.
     */
    moreResultsAvailable: boolean;
}
interface FoldedResultAnalyticsClient {
    logShowMoreFoldedResults: (result: Result) => ClickAction;
    logShowLessFoldedResults: () => CustomAction;
}
/**
 * Creates a core `FoldedResultList` controller instance.
 *
 * @param engine - The headless engine.
 * @param props - The configurable `FoldedResultList` properties.
 * @param analyticsClient - A FoldedResultAnalyticsClient to send the appropriate analytics calls.
 * @returns A `FoldedResultList` controller instance.
 *
 * @group Controllers
 * @category FoldedResultList
 */
export declare function buildCoreFoldedResultList(engine: CoreEngine, props: CoreFoldedResultListProps, analyticsClient: FoldedResultAnalyticsClient): FoldedResultList;
