/**
 * 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 { QueryBuilderState } from './QueryBuilderState.js';
import { AbstractPropertyExpression, FunctionExpression, type EnumValueInstanceValue, type GraphFetchTreeInstanceValue, type ValueSpecificationVisitor, type LambdaFunction, type KeyExpressionInstanceValue, type INTERNAL__PropagatedValue, type ValueSpecification, type CollectionInstanceValue, LambdaFunctionInstanceValue, type ColSpecArrayInstance, InstanceValue, INTERNAL__UnknownValueSpecification, PrimitiveInstanceValue, SimpleFunctionExpression, VariableExpression, type ColSpecInstanceValue, AccessorInstanceValue } from '@finos/legend-graph';
import type { QueryBuilderParameterValue } from './QueryBuilderParametersState.js';
export declare const isUsedDateFunctionSupportedInFormMode: (valueSpec: ValueSpecification) => boolean;
/**
 * This is the value specification processor (a.k.a state builder) for query builder.
 *
 * Unlike value specification builder which takes care of transforming the value specification
 * from `protocol` to `metamodel`, and doing some (naive) type-inferencing, the processor takes care
 * of traversing the query, analyzing it to build the query builder state. The processor represents
 * a particular way we want to look at the query, if the query is not like what the processor
 * expects, or understands, query builder state could not be built, i.e. the query will be deemed
 * unsupported by query builder
 *
 * NOTE: While traversing the expression, this processor also does a fair amount of
 * validations and assertions--enough to properly build the state. Unlike the builder,
 * the processor should NEVER modify the metamodel, just traversing it.
 */
export declare class QueryBuilderValueSpecificationProcessor implements ValueSpecificationVisitor<void> {
    readonly queryBuilderState: QueryBuilderState;
    /**
     * A value specification is a tree of value specifications.
     *
     * This structure may not intuitively correspond to how we write it in Pure
     * For example, consider the following expression in Pure:
     *
     * | Person.all()->filter(x|$x.age > 0)->project([x|$x.name], ['Name'])->sort([desc('Name')]);
     *
     * which is equivalent to the more cryptic version:
     *
     * | sort(project(filter(all(Person), x|$x.age > 0), [x|$x.name], ['Name']), [desc('Name')]);
     *
     * Hence, the metamodel looks something like this (with some parts redacted)
     * {
     *   "function": "sort",
     *   "parameters": [
     *     {
     *       "function": "project",
     *       "parameters": [
     *         {
     *           "function": "filter",
     *           "parameters": [
     *             {
     *               "function": "getAll",
     *               ...
     *             },
     *             ... // filter() expression
     *           ]
     *         },
     *         ... // project() expression column and alias
     *       ]
     *     },
     *     {
     *       "_type": "collection",
     *       "values": [
     *         {
     *           "function": "desc",
     *           ... // desc() expression
     *         }
     *       ]
     *     }
     *   ]
     * }
     *
     * The first grammar form is farily declarative in nature and perhaps more intuitive.
     * We tend to think, in terms of order of running:
     * all() --> filter() --> project() --> sort()
     *
     * However, in reality, when the expression is used or read, the order of traversal is reversed:
     * sort() --> project() --> filter() --> all()
     *
     * Now, in the context of the value specification processor, we need information about preceding
     * expression in order to validate the usage context of functions, (for example, we want to only
     * support project() after all() or filter()). In the case of function expression chain,
     * we have to look at the function expression first parameter. There are some other context,
     * such as what happens within the second parameter of the sort() expression
     * in this case, we have the desc() expression, but it's not part of the main expression chain;
     * however, we need to verify desc() is used within sort(), in this case, we have to record
     * the parent expression. This is when the following attribute comes into use when processing
     * value specification.
     */
    readonly parentExpression?: SimpleFunctionExpression | undefined;
    readonly parentLambda: LambdaFunction;
    private constructor();
    static process(valueSpecification: ValueSpecification, parentLambda: LambdaFunction, queryBuilderState: QueryBuilderState): void;
    /**
     * Process value specification with information about parent function expression
     * in order to be used in some validation/assertion
     */
    static processChild(valueSpecification: ValueSpecification, parentExpression: SimpleFunctionExpression, parentLambda: LambdaFunction, queryBuilderState: QueryBuilderState): void;
    visit_INTERNAL__UnknownValueSpecification(valueSpecification: INTERNAL__UnknownValueSpecification): void;
    visit_INTERNAL__PropagatedValue(valueSpecification: INTERNAL__PropagatedValue): void;
    visit_FunctionExpression(valueSpecification: FunctionExpression): void;
    visit_AccessorInstanceValue(valueAccessorInstanceValue: AccessorInstanceValue): void;
    visit_SimpleFunctionExpression(valueSpecification: SimpleFunctionExpression): void;
    visit_VariableExpression(valueSpecification: VariableExpression): void;
    visit_AbstractPropertyExpression(valueSpecification: AbstractPropertyExpression): void;
    visit_InstanceValue(valueSpecification: InstanceValue): void;
    visit_KeyExpressionInstanceValue(valueSpecification: KeyExpressionInstanceValue): void;
    visit_CollectionInstanceValue(valueSpecification: CollectionInstanceValue): void;
    visit_EnumValueInstanceValue(valueSpecification: EnumValueInstanceValue): void;
    visit_PrimitiveInstanceValue(valueSpecification: PrimitiveInstanceValue): void;
    visit_LambdaFunctionInstanceValue(valueSpecification: LambdaFunctionInstanceValue): void;
    visit_GraphFetchTreeInstanceValue(valueSpecification: GraphFetchTreeInstanceValue): void;
    visit_ColSpecArrayInstance(valueSpecification: ColSpecArrayInstance): void;
    visit_ColSpecInstance(valueSpeciciation: ColSpecInstanceValue): void;
}
export declare const processParameters: (parameters: VariableExpression[], queryBuilderState: QueryBuilderState, options?: {
    parameterValues?: Map<string, QueryBuilderParameterValue> | undefined;
}) => void;
export declare const processQueryLambdaFunction: (lambdaFunction: LambdaFunction, queryBuilderState: QueryBuilderState, parameterOptions?: {
    parameterValues?: Map<string, QueryBuilderParameterValue> | undefined;
}) => void;
//# sourceMappingURL=QueryBuilderStateBuilder.d.ts.map