import { TypedEmitter } from '../util';
type FilterEvent = 'change' | 'refresh' | 'scheduleRefresh' | 'beforeRefresh';
export interface ChangeValueOptions {
    emitEvents?: FilterEvent[];
    clearResult?: boolean;
    actionType?: 'add' | 'remove';
    clickedValueKey?: string;
}
export type FilterItem<T> = T extends (infer V)[] ? V : T;
export interface FilterEventOptions {
    clearResult?: boolean;
    actionType?: 'add' | 'remove';
    clickedValueKey?: string;
}
interface FilterEventsSchema {
    refresh: (opt: FilterEventOptions | undefined) => unknown;
    beforeRefresh: (opt: FilterEventOptions | undefined) => unknown;
    change: (opt?: FilterEventOptions) => unknown;
    scheduleRefresh: (opt?: FilterEventOptions) => unknown;
}
export type FilterEvents = TypedEmitter<FilterEventsSchema>;
export interface Filter<T> {
    events: TypedEmitter<FilterEventsSchema>;
    name: string;
    persistent?: boolean;
    readonly value: T;
    readonly toArray: FilterItem<T>[];
    readonly _toArray: (value: T) => FilterItem<T>[];
    readonly isEmpty: boolean;
    readonly toQueryString: string;
    readonly decode: (value: unknown) => T;
    readonly encode: (value: T) => unknown;
    readonly size: number;
    readonly itemKey: (item: FilterItem<T>) => string;
    readonly itemName: (item: FilterItem<T>) => string;
    readonly matches: (item: FilterItem<T>, value: T) => boolean;
    readonly equals?: (item1: FilterItem<T>, item2: FilterItem<T>) => boolean;
    readonly isCustomField?: boolean;
    applyFromQueryString(str: string): void;
    setValue(value: T, options?: ChangeValueOptions): void;
    changeValue(value: T, options?: ChangeValueOptions): void;
    refresh(value: T, options?: ChangeValueOptions): void;
    scheduleRefresh(value: T): void;
    reset(options?: ChangeValueOptions): void;
    remove(items: FilterItem<T>[], options?: ChangeValueOptions): void;
    clone(...args: any[]): Filter<T>;
    hasDiff(items: T): boolean;
    _hideFromToolbar?: boolean;
}
export interface FilterStateBaseParams<T> {
    name?: string;
    /**
     * Marks the filter as a "context" or "scope" filter. This makes the filter not be visible in the sub-toolbar tag list, not saved in views, not counted as "X filters applied".
     * @external
     */
    persistent?: boolean;
    /**
     * The value to initialize the filter with (Optional)
     * @external
     */
    initialValue?: T;
    /**
     * A callback function that accepts an item and returns a unique ID of it. typically `item.id`.
     * @external
     */
    itemKey: (item: FilterItem<T>) => string;
    /**
     * A callback function that accepts an item and returns the item name which is used in many messages through cairo
     * @external
     */
    itemName: (item: FilterItem<T>) => string;
    /**
     * A function which accepts 2 items and returns true if they are equal
     * @external
     */
    equals?: (item1: FilterItem<T>, item2: FilterItem<T>) => boolean;
    /**
     * If the filter is a custom field
     */
    isCustomField?: boolean;
}
export type FiltersMap = {
    [key: string]: Filter<any> | undefined;
};
export type OptionalFiltersMap = {
    [key: string]: undefined;
};
export {};
//# sourceMappingURL=filter.d.ts.map