import { SortOrder } from '../sort';
import { Filter, FiltersMap, OptionalFiltersMap } from '../filter';
export type ExtractFilterValue<T> = T extends Filter<infer U> ? U : undefined;
export type RawFilters<F extends FiltersMap> = Partial<{
    [P in keyof F]: ExtractFilterValue<F[P]>;
}>;
export type FiltersKey<F extends FiltersMap> = Partial<{
    [P in keyof F]: string[] | undefined | null;
}>;
export type AllFilters<F extends FiltersMap> = F & {
    search: Filter<string>;
};
export type FiltersValues<F extends FiltersMap> = {
    [P in keyof F]: {
        value?: ExtractFilterValue<F[P]>;
    };
};
export interface Sort {
    field: string;
    direction: SortOrder;
}
export interface ComputedQuery<F extends FiltersMap = OptionalFiltersMap> {
    /**
     * Number of items to fetch for each page
     * @external
     */
    limit: number;
    /**
     * The index of the item to start fetching items from.<br>
     * Relevant for APIs that support offset pagination.<br>
     * Not available on `CursorQuery`.
     * @external
     */
    offset: number;
    page: number;
    /**
     * Current search term. Defaults to `undefined` for empty search.
     * @external
     */
    search?: string;
    /**
     * Current search term. Defaults to `''` for empty search.
     * @external
     */
    rawSearch: string;
    /**
     * The `cursor` returned from the server, to be sent back to it in the next call.<br>
     * Relevant for APIs that support cursor pagination.<br>
     * Not available on `OffsetQuery`.
     * @external
     */
    cursor?: string | null;
    /**
     * Current state of the filters. Each key holds the value of the filter, according to its type, defined in [CollectionConfig](./?path=/story/common-hooks--usecollection).
     * @external
     */
    filters: RawFilters<F>;
    /**
     * Same as `filters` but defaults to `undefined` for empty filter values.
     * @external
     */
    rawFilters: RawFilters<F>;
    /**
     * Whether at least one filter is not empty.
     * @external
     */
    hasActiveFilters: boolean;
    /**
     * Whether at least one filter is not empty, not including tabs.
     * @external
     */
    hasNonPersistentActiveFilters: boolean;
    /**
     * Current sort applied to the collection.
     * @external
     */
    sort?: {
        fieldName: string;
        order: 'asc' | 'desc';
    }[];
    /**
     * @deprecated Use `fields` instead
     */
    columns?: string[];
    /**
     * Array of projected fields. A list of specific field names to fetch. Use this to optimize your server query to load only needed columns. Note that a mapping between client-side columns to server-fields is usually required.
     * Use `refreshOnColumnsChange` of [useCollection](./?path=/story/common-hooks--usecollection) to control whether the collection should be refreshed when this value changes.
     * @external
     */
    fields?: string[];
    /**
     * Extra data to be passed to the query.
     * @external
     */
    extra?: string;
}
export interface ComputedQueryFull<F extends FiltersMap = OptionalFiltersMap> extends ComputedQuery<F> {
    filtersKey: FiltersKey<F>;
    nonPersistentFiltersKey: FiltersKey<F>;
}
//# sourceMappingURL=computedQuery.d.ts.map