import { CollectionEvents, ComputedQuery, DataResultRaw, Filter, FiltersMap, QueryOptions } from '../model';
import type { ExtendedFields } from '../services';
import type { FetchTotalFn } from './paginationModeConfig';
export interface CollectionConfigBase<T, F extends FiltersMap> {
    /**
     * Whether to disable "Select All" server simulation for bulk selection.
     * @external
     */
    disableAutoSelectAllCount?: boolean;
    /**
     * Whether to enable new "Select All" logic.
     * <br> <br>
     * If `true`: <br>
     * - Unchecking items after checking "Select All" does not fallback to specific selection logic and values. This means in `<bulkActionToolbar />` and `<MultiBulkActionToolbar />`, "Total Selected" will show `total - unchecked items` and `isSelectAll` will be true. <br>
     * - You will receive a list of unchecked IDs.
     * @external
     */
    useNewSelectAllLogic?: boolean;
    /**
     * Unique value for each API endpoint consumed in `fetchData`.
     * @external
     */
    queryName: string;
    /**
     * Entity fqdn.
     * @external
     */
    fqdn?: string;
    /**
     * The `ExtendedFields` object used to render custom field values
     * Optional in case your data complies to the type `{ extendedFields: ExtendedFields }`
     */
    toExtendedFields?: (item: T) => ExtendedFields | undefined | null;
    /**
     * Message shown in a toast when fetching from the server fails.
     * <br> <br>
     * If the function returns a nullish value, no toast is shown.
     * @external
     * @deprecated Instead of using `fetchErrorMessage`, use `errorState` prop in the component, which will show the error message in the card.
     */
    fetchErrorMessage?: (params: {
        err: unknown;
        isOnline: boolean;
    }) => string | null | undefined;
    search?: Filter<string>;
    queryOptions?: QueryOptions;
    /**
     * Persist the selected filters, search & sort in the query parameters of the URL.<br/>
     * For improved readability, sort & columns are formatted in CSV-like formatting, i.e "?sort=name+desc,price+asc". Do not use commas and/or spaces for your columns IDs.<br>
     * Note: The filters from the selected view will be persist, but the actual view will not be selected
     * @default false
     */
    persistQueryToUrl?: boolean;
    /**
     * Whether the collection refreshes when different columns are selected.
     * <br> <br>
     * Selected columns are passed in `fetchData(query.columns)`.
     * @default false
     * @external
     */
    refreshOnColumnsChange?: boolean;
    initialPage?: DataResultRaw<T>;
    deferInitialLoading?: boolean;
    /**
     * Preserve or clear selection after applying a new search or filter.
     * @default preserve
     * @external
     */
    selectionConsistencyMode?: 'preserve' | 'clear';
    /**
     * Optional callbacks for various events of the collection state lifecycle
     * - `onInitialPageFetched` - when the first page of items is ready
     * - `onSearch` - when fetching new items as a result new search
     * - `onSearchResults` - when the result of a search is ready
     * - `onNewPageStart` - when starting to load the next page of items
     * - `onNewPageAdded` - when the result of the next page is ready
     * - `onError` - When `fetchData` throws an error. Return `true` from this function if the error was reported and shouldn't be reported again internally.
     */
    events?: CollectionEvents<F>;
}
export interface CollectionConfigAnyPaginationMode<T, F extends FiltersMap> extends CollectionConfigBase<T, F> {
    /**
     * Function that fetches the collection data.<br> <br>
     * Supported parameters: <br>
     * - `query`: [object] [ComputedQuery](./com?path=/story/common-models--computedquery) instance.
     * <br> <br>
     *
     * Must return a [DataResultRaw](./?path=/story/common-models--dataresultraw) Promise.
     * @external
     */
    fetchData: (query: ComputedQuery<F>) => Promise<DataResultRaw<T>>;
    /**
     * A function that fetches the total number of items in the collection.<br> <br>
     * Supported parameters: <br>
     * - `query`: [object] [ComputedQuery](./com?path=/story/common-models--computedquery) of type `CursorQuery`.
     * <br> <br>
     * Must return a number Promise.
     * @external
     */
    fetchTotal?: FetchTotalFn;
    /**
     * Defines the filters that the collection supports.
     * <br> <br>
     * Either an [arrayFilter](./?path=/story/features-filter-factories--arrayfilter) or a [customFilter](./?path=/story/features-filter-factories--customfilter).
     * @external
     */
    filters: F;
    /**
     * Used to identify the item in many messages from Wix Patterns.
     * <br> <br>
     * For example, '{entity} "{itemName}" was deleted successfully' may become 'Contact "Johnny Doe" was deleted successfully'.
     * <br> <br>
     * If your data has an ID, then `itemKey` will default to this ID.
     * @external
     */
    itemName: (item: T) => string;
    /**
     * Unique key within the collection. The item's ID is often used for its key.
     * <br> <br>
     * If your data has an ID, then `itemKey` will default to this ID.
     * @external
     */
    itemKey: (item: T) => string;
    /**
     * Maximum number of items fetched per page.
     * @external
     */
    limit?: number;
}
export interface CollectionConfig<T, F extends FiltersMap> extends CollectionConfigAnyPaginationMode<T, F> {
    /**
     * Pagination type supported by `fetchData`.
     * <br> <br>
     * Supported values: <br>
     * - `"offset"`: Server accepts `query.offset`. <br>
     * - `"cursor"`: Server returns a cursor when `fetchData` is called.
     * @default offset
     * @external
     */
    paginationMode?: 'cursor' | 'offset';
}
//# sourceMappingURL=collectionConfig.d.ts.map