import { IRowNode } from 'ag-grid-enterprise';
import { AdaptableIcon, ColumnFilter } from '../../types';
import { AdaptableColumn, AdaptableColumnDataType } from './AdaptableColumn';
import { ColumnScope } from './ColumnScope';
import { BaseContext } from './BaseContext';
import { TreeSelectionState } from '@infinite-table/infinite-react';
/**
 * Predicate object used by AdapTableQL - essentially a boolean function
 */
export interface AdaptablePredicate<PREDICATE_TYPE = string> {
    /**
     * Id of Predicate (e.g. `Equals`, `GreaterThan`)
     */
    PredicateId: PREDICATE_TYPE;
    /**
     * Optional Inputs that might be needed for evaluation
     */
    Inputs?: any[];
}
/**
 * Restricts a Predicate to a given Column
 */
export interface AdaptableColumnPredicate extends AdaptablePredicate {
    /**
     * Id of Column which will be evaluated by the Predicate
     */
    ColumnId?: string;
}
/**
 * Defines a Predicate - include where it can run and what it does
 */
export interface AdaptablePredicateDef<PREDICATE_TYPE = string> {
    /**
     * Predicate Id
     */
    id: PREDICATE_TYPE;
    /**
     * Name of the Predicate
     */
    label: string;
    /**
     * Columns (or DataTypes) where Predicate is active
     */
    columnScope: ColumnScope;
    /**
     * Modules where Predicate can run
     */
    moduleScope: PredicateModuleScope[];
    /**
     * Inputs the Predicate can take
     */
    inputs?: PredicateDefInput[];
    /**
     * Actual boolean function invoked when evaluating the Predicate
     */
    handler: (params: PredicateDefHandlerContext) => boolean;
    /**
     * String representation of the Predicate
     */
    toString?: (params: PredicateDefToStringParams) => string;
    /**
     * Icon to show (primarily used in Filter dropdown)
     */
    icon?: AdaptableIcon | {
        text: string;
    };
    /**
     * Keyboard shortcuts to initiate predicate - used in Quick Filter bar
     */
    shortcuts?: string[];
}
export interface AdaptablePredicateDefPartialWithExtends<PREDICATE_TYPE = string> extends Partial<AdaptablePredicateDef<PREDICATE_TYPE>> {
    extends: PREDICATE_TYPE;
    id: PREDICATE_TYPE;
}
/**
 * Defines an Input to a Predicate
 */
export interface PredicateDefInput {
    type: 'number' | 'text' | 'date' | 'boolean';
    label?: string;
    defaultValue?: any;
}
/**
 * Object passed into an Adaptable Predicate Definition
 */
export interface PredicateDefHandlerContext extends BaseContext {
    /**
     * Value in cell being evaluated (normalized as per Column DataType)
     */
    value: any;
    /**
     * Raw value in cell being evaluated (as per underlying data source)
     */
    rawValue: any;
    /**
     * Previous value in cell (e.g. if evaluating an edit)
     */
    oldValue: any;
    /**
     * Display value in cell being evaluated
     */
    displayValue: any;
    /**
     * AG Grid Row node which contains the cell
     */
    node: IRowNode;
    /**
     * AdapTable Column which contains the cell
     */
    column: AdaptableColumn;
    /**
     * Any (optional) inputs required to perform evaluation
     */
    inputs?: any[];
    /**
     * Logic used when combining multiple Predicates ('AND'|'OR')
     */
    predicatesOperator?: ColumnFilter['PredicatesOperator'];
    /**
     * For grouped columns, the array with all the values starting from the root group to
     * the current node
     */
    groupValues?: string[];
    /**
     * Optional TreeSelectionState - used for `In` predicate, when evaluating
     * the grouped column. If this is not provided, another valid implementation
     * is used.
     */
    treeSelectionState?: TreeSelectionState;
}
/**
 * Inputs required for a Predicate
 */
export interface PredicateDefToStringParams {
    inputs: any[];
}
/**
 * Defines which Modules use the Predicate
 */
export type PredicateModuleScope = 'columnFilter' | 'alert' | 'flashingcell' | 'formatColumn' | 'badgeStyle';
/**
 * Array of Predicate Defs which are shipped by AdapTable
 */
export declare const SystemPredicateDefs: AdaptablePredicateDef[];
export declare const SystemFilterPredicateIds: string[];
export declare const SystemAlertPredicateIds: string[];
export declare const SystemFormatColumnPredicateIds: string[];
export declare const SystemFlashingCellPredicateIds: string[];
export declare const SystemBadgeStylePredicateIds: string[];
/**
 * Column Filter Definition for a specific Column
 */
export interface ColumnFilterDef {
    dataType: AdaptableColumnDataType;
    predicates: AdaptablePredicateDef[];
    columnFilter: ColumnFilter;
}
