/**
 * Copyright (c) 2020-present, Goldman Sachs
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import type { TreeData, TreeNodeData } from '@finos/legend-art';
import { type PureModel, type Type, type ValueSpecification, type VariableExpression, type SimpleFunctionExpression, type LambdaFunction } from '@finos/legend-graph';
import { type GeneratorFn, ActionState, type Hashable } from '@finos/legend-shared';
import { QueryBuilderAggregateColumnState } from '../aggregation/QueryBuilderAggregationState.js';
import type { QueryBuilderPostFilterOperator } from './QueryBuilderPostFilterOperator.js';
import { QueryBuilderProjectionColumnState, type QueryBuilderProjectionColumnDragSource, QueryBuilderDerivationProjectionColumnState } from '../projection/QueryBuilderProjectionColumnState.js';
import { QUERY_BUILDER_GROUP_OPERATION } from '../../../QueryBuilderGroupOperationHelper.js';
import type { QueryBuilderTDSState } from '../QueryBuilderTDSState.js';
import type { QueryBuilderTDSColumnState } from '../QueryBuilderTDSColumnState.js';
import { TDS_COLUMN_GETTER } from '../../../../graph/QueryBuilderMetaModelConst.js';
export declare enum QUERY_BUILDER_POST_FILTER_DND_TYPE {
    GROUP_CONDITION = "QUERY_BUILDER_POST_FILTER_DND_TYPE.GROUP_CONDITION",
    CONDITION = "QUERY_BUILDER_POST_FILTER_DND_TYPE.CONDITION",
    BLANK_CONDITION = "QUERY_BUILDER_POST_FILTER_DND_TYPE.BLANK_CONDITION"
}
export declare const getTypeFromDerivedProperty: (derivedProperty: TDS_COLUMN_GETTER, graph: PureModel) => Type | undefined;
export declare abstract class QueryBuilderPostFilterTreeNodeData implements TreeNodeData, Hashable {
    readonly id: string;
    readonly label = "";
    isOpen?: boolean | undefined;
    parentId?: string | undefined;
    constructor(parentId: string | undefined);
    abstract get dragPreviewLabel(): string;
    setIsOpen(val: boolean): void;
    setParentId(val: string | undefined): void;
    abstract get hashCode(): string;
}
export interface QueryBuilderPostFilterConditionDragSource {
    node: QueryBuilderPostFilterTreeNodeData;
}
export type QueryBuilderPostFilterDropTarget = QueryBuilderProjectionColumnDragSource | QueryBuilderPostFilterConditionDragSource;
export declare class QueryBuilderPostFilterTreeGroupNodeData extends QueryBuilderPostFilterTreeNodeData implements Hashable {
    groupOperation: QUERY_BUILDER_GROUP_OPERATION;
    childrenIds: string[];
    constructor(parentId: string | undefined, groupOperation: QUERY_BUILDER_GROUP_OPERATION);
    get dragPreviewLabel(): string;
    setGroupOperation(val: QUERY_BUILDER_GROUP_OPERATION): void;
    addChildNode(node: QueryBuilderPostFilterTreeNodeData): void;
    removeChildNode(node: QueryBuilderPostFilterTreeNodeData): void;
    addChildNodeAt(node: QueryBuilderPostFilterTreeNodeData, idx: number): void;
    get hashCode(): string;
}
export declare class QueryBuilderPostFilterTreeConditionNodeData extends QueryBuilderPostFilterTreeNodeData implements Hashable {
    condition: PostFilterConditionState;
    isNewlyAdded: boolean;
    constructor(parentId: string | undefined, condition: PostFilterConditionState, isNewlyAdded?: boolean);
    setIsNewlyAdded(val: boolean): void;
    get dragPreviewLabel(): string;
    get hashCode(): string;
}
export declare class QueryBuilderPostFilterTreeBlankConditionNodeData extends QueryBuilderPostFilterTreeNodeData implements Hashable {
    constructor(parentId: string | undefined);
    get dragPreviewLabel(): string;
    get hashCode(): string;
}
export declare abstract class PostFilterConditionValueState implements Hashable {
    conditionState: PostFilterConditionState;
    constructor(conditionState: PostFilterConditionState);
    get type(): Type | undefined;
    get isCollection(): boolean;
    get hashCode(): string;
    abstract appendConditionValue(expressionVal: SimpleFunctionExpression, parentExpression: LambdaFunction | undefined): void;
}
export declare class PostFilterValueSpecConditionValueState extends PostFilterConditionValueState {
    value?: ValueSpecification | undefined;
    constructor(conditionState: PostFilterConditionState, value?: ValueSpecification | undefined);
    get type(): Type | undefined;
    setValue(val: ValueSpecification | undefined): ValueSpecification | undefined;
    appendConditionValue(expressionVal: SimpleFunctionExpression, parentExpression: LambdaFunction | undefined): void;
    get isCollection(): boolean;
    get hashCode(): string;
}
export declare class PostFilterTDSColumnValueConditionValueState extends PostFilterConditionValueState {
    tdsColumn: QueryBuilderTDSColumnState;
    constructor(conditionState: PostFilterConditionState, tdsColumn: QueryBuilderTDSColumnState);
    get type(): Type | undefined;
    get isCollection(): boolean;
    appendConditionValue(expressionVal: SimpleFunctionExpression, parentExpression: LambdaFunction | undefined): void;
    changeCol(col: QueryBuilderTDSColumnState): void;
}
export declare class PostFilterConditionState implements Hashable {
    readonly postFilterState: QueryBuilderPostFilterState;
    leftConditionValue: QueryBuilderTDSColumnState;
    rightConditionValue: PostFilterConditionValueState;
    operator: QueryBuilderPostFilterOperator;
    typeaheadSearchResults: string[] | undefined;
    typeaheadSearchState: ActionState;
    constructor(postFilterState: QueryBuilderPostFilterState, colState: QueryBuilderTDSColumnState, operator: QueryBuilderPostFilterOperator | undefined);
    get columnName(): string;
    get operators(): QueryBuilderPostFilterOperator[];
    setRightConditionVal(val: PostFilterConditionValueState): void;
    buildFromValueSpec(val: ValueSpecification | undefined): void;
    handleTypeaheadSearch(searchValue?: ValueSpecification | undefined): GeneratorFn<void>;
    changeOperator(val: QueryBuilderPostFilterOperator): void;
    setColumnState(val: QueryBuilderProjectionColumnState | QueryBuilderAggregateColumnState): void;
    setOperator(val: QueryBuilderPostFilterOperator): void;
    changeColumn(columnState: QueryBuilderProjectionColumnState): GeneratorFn<void>;
    get hashCode(): string;
}
export declare class QueryBuilderPostFilterState implements TreeData<QueryBuilderPostFilterTreeNodeData>, Hashable {
    tdsState: QueryBuilderTDSState;
    lambdaParameterName: string;
    selectedNode?: QueryBuilderPostFilterTreeNodeData | undefined;
    isRearrangingConditions: boolean;
    operators: QueryBuilderPostFilterOperator[];
    rootIds: string[];
    nodes: Map<string, QueryBuilderPostFilterTreeNodeData>;
    derivedColumnBeingDropped: QueryBuilderDerivationProjectionColumnState | undefined;
    constructor(tdsState: QueryBuilderTDSState, operators: QueryBuilderPostFilterOperator[]);
    setRearrangingConditions(val: boolean): void;
    setSelectedNode(val: QueryBuilderPostFilterTreeNodeData | undefined): void;
    getNode(id: string): QueryBuilderPostFilterTreeNodeData;
    setDerivedColumnBeingDropped(val: QueryBuilderDerivationProjectionColumnState | undefined): void;
    get isEmpty(): boolean;
    private getParentNode;
    get referencedTDSColumns(): QueryBuilderTDSColumnState[];
    getRootNode(): QueryBuilderPostFilterTreeNodeData | undefined;
    private addRootNode;
    replaceBlankNodeWithNode(node: QueryBuilderPostFilterTreeNodeData, blankNode: QueryBuilderPostFilterTreeBlankConditionNodeData): void;
    setLambdaParameterName(val: string): void;
    addGroupConditionNodeFromNode(fromNode: QueryBuilderPostFilterTreeNodeData | undefined): void;
    newGroupWithConditionFromNode(node: QueryBuilderPostFilterTreeNodeData | undefined, fromNode: QueryBuilderPostFilterTreeNodeData | undefined): void;
    addNodeFromNode(node: QueryBuilderPostFilterTreeNodeData, fromNode: QueryBuilderPostFilterTreeNodeData | undefined): void;
    private removeNode;
    removeNodeAndPruneBranch(node: QueryBuilderPostFilterTreeNodeData): void;
    /**
     * Cleanup unecessary group nodes (i.e. group node whose group operation is the same as its parent's)
     */
    simplifyTree(): void;
    private pruneOrphanNodes;
    private pruneChildlessGroupNodes;
    pruneTree(): void;
    /**
     * If group node has fewer than 2 children, flatten it
     */
    private squashGroupNode;
    collapseTree(): void;
    expandTree(): void;
    isVariableUsed(variable: VariableExpression): boolean;
    get allValidationIssues(): string[];
    get hasInvalidFilterValues(): boolean;
    get hasInvalidDerivedPropertyParameters(): boolean;
    get hashCode(): string;
}
//# sourceMappingURL=QueryBuilderPostFilterState.d.ts.map