/**
 * 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 GeneratorFn, ActionState } from '@finos/legend-shared';
import { QueryBuilderFilterState } from './filter/QueryBuilderFilterState.js';
import { QueryBuilderFetchStructureState } from './fetch-structure/QueryBuilderFetchStructureState.js';
import { QueryBuilderTextEditorState } from './QueryBuilderTextEditorState.js';
import { QueryBuilderExplorerState } from './explorer/QueryBuilderExplorerState.js';
import { QueryBuilderResultState } from './QueryBuilderResultState.js';
import { QueryBuilderUnsupportedQueryState } from './QueryBuilderUnsupportedQueryState.js';
import { type Class, type Mapping, type Runtime, type GraphManagerState, type ValueSpecification, type Type, type QueryGridConfig, type QueryExecutionContext, type FunctionAnalysisInfo, type GraphData, RawLambda, VariableExpression, ObserverContext, type LambdaFunction } from '@finos/legend-graph';
import type { CommandRegistrar, GenericLegendApplicationStore } from '@finos/legend-application';
import { QueryFunctionsExplorerState } from './explorer/QueryFunctionsExplorerState.js';
import { QueryBuilderParametersState } from './QueryBuilderParametersState.js';
import type { QueryBuilderFilterOperator } from './filter/QueryBuilderFilterOperator.js';
import { QueryBuilderChangeDetectionState } from './QueryBuilderChangeDetectionState.js';
import { QueryBuilderMilestoningState } from './milestoning/QueryBuilderMilestoningState.js';
import { QueryBuilderWatermarkState } from './watermark/QueryBuilderWatermarkState.js';
import { QueryBuilderConstantsState } from './QueryBuilderConstantsState.js';
import { QueryBuilderCheckEntitlementsState } from './entitlements/QueryBuilderCheckEntitlementsState.js';
import { QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS } from '../graph/QueryBuilderMetaModelConst.js';
import type { QueryBuilderInternalizeState } from './QueryBuilderInternalizeState.js';
import { type QueryBuilderExecutionContextState } from './QueryBuilderExecutionContextState.js';
import type { QueryBuilderConfig } from '../graph-manager/QueryBuilderConfig.js';
import { QueryBuilderChangeHistoryState } from './QueryBuilderChangeHistoryState.js';
import { type QueryBuilderWorkflowState } from './query-workflow/QueryBuilderWorkFlowState.js';
import { type QueryChatState } from './QueryChatState.js';
import type { QueryBuilderDataCubeViewerState } from './data-cube/QueryBuilderDataCubeViewerState.js';
import type { DepotEntityWithOrigin, QueryableSourceInfo } from '@finos/legend-storage';
export type QueryableClassMappingRuntimeInfo = QueryableSourceInfo & {
    class: string;
    mapping: string;
    runtime: string;
};
export type QueryBuilderExtraFunctionAnalysisInfo = {
    functionInfoMap: Map<string, FunctionAnalysisInfo>;
    dependencyFunctionInfoMap: Map<string, FunctionAnalysisInfo>;
};
export declare enum QUERY_BUILDER_LAMBDA_WRITER_MODE {
    STANDARD = "STANDARD",
    TYPED_FETCH_STRUCTURE = "TYPED_FETCH_STRUCTURE"
}
export type EntityWithOriginOption = {
    label: string;
    value: DepotEntityWithOrigin;
};
export declare class ExtraOptionsConfig<T> {
    label: string;
    type: string;
    options: {
        label: string;
        value: T;
    }[] | undefined;
    selectedValue: T | undefined;
    onChange: (val: T) => void;
    placeholder?: string | undefined;
    disabled?: boolean | undefined;
    constructor(label: string, type: string, options: {
        label: string;
        value: T;
    }[] | undefined, selectedValue: T | undefined, onChange: (val: T) => void, placeholder?: string | undefined, disabled?: boolean | undefined);
    setOptions(options: {
        label: string;
        value: T;
    }[] | undefined): void;
}
export declare abstract class QueryBuilderState implements CommandRegistrar {
    readonly applicationStore: GenericLegendApplicationStore;
    readonly graphManagerState: GraphManagerState;
    readonly changeDetectionState: QueryBuilderChangeDetectionState;
    readonly queryCompileState: ActionState;
    readonly observerContext: ObserverContext;
    readonly config: QueryBuilderConfig | undefined;
    readonly workflowState: QueryBuilderWorkflowState;
    explorerState: QueryBuilderExplorerState;
    functionsExplorerState: QueryFunctionsExplorerState;
    parametersState: QueryBuilderParametersState;
    constantState: QueryBuilderConstantsState;
    milestoningState: QueryBuilderMilestoningState;
    fetchStructureState: QueryBuilderFetchStructureState;
    filterState: QueryBuilderFilterState;
    watermarkState: QueryBuilderWatermarkState;
    checkEntitlementsState: QueryBuilderCheckEntitlementsState;
    filterOperators: QueryBuilderFilterOperator[];
    resultState: QueryBuilderResultState;
    textEditorState: QueryBuilderTextEditorState;
    unsupportedQueryState: QueryBuilderUnsupportedQueryState;
    changeHistoryState: QueryBuilderChangeHistoryState;
    isQueryChatOpened: boolean;
    showFunctionsExplorerPanel: boolean;
    showParametersPanel: boolean;
    isEditingWatermark: boolean;
    isCheckingEntitlments: boolean;
    isCalendarEnabled: boolean;
    isLocalModeEnabled: boolean;
    dataCubeViewerState: QueryBuilderDataCubeViewerState | undefined;
    INTERNAL__enableInitializingDefaultSimpleExpressionValue: boolean;
    lambdaWriteMode: QUERY_BUILDER_LAMBDA_WRITER_MODE;
    class?: Class | undefined;
    getAllFunction: QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS;
    executionContextState: QueryBuilderExecutionContextState;
    internalizeState?: QueryBuilderInternalizeState | undefined;
    queryChatState?: QueryChatState | undefined;
    sourceInfo?: QueryableSourceInfo | undefined;
    TEMPORARY__setupPanelContentRenderer?: (() => React.ReactNode) | undefined;
    constructor(applicationStore: GenericLegendApplicationStore, graphManagerState: GraphManagerState, workflowState: QueryBuilderWorkflowState, config: QueryBuilderConfig | undefined, sourceInfo?: QueryableSourceInfo | undefined);
    TEMPORARY_initializeExecContext(isTypedTDS: boolean): QueryBuilderExecutionContextState;
    get isMappingReadOnly(): boolean;
    get isRuntimeReadOnly(): boolean;
    get sideBarClassName(): string | undefined;
    get isParameterSupportDisabled(): boolean;
    get isResultPanelHidden(): boolean;
    /**
     * This flag is for turning on/off DnD support from projection panel to filter panel,
     * and will be leveraged when the concepts of workflows are introduced into query builder.
     */
    get TEMPORARY__isDnDFetchStructureToFilterSupported(): boolean;
    get allVariables(): VariableExpression[];
    get allVariableNames(): string[];
    get isFetchStructureTyped(): boolean;
    get forceFromExpressionForExec(): boolean;
    setLambdaWriteMode(val: QUERY_BUILDER_LAMBDA_WRITER_MODE): void;
    getQueryExecutionContext(): QueryExecutionContext;
    propagateExecutionContextChange(isGraphBuildingNotRequired?: boolean): Promise<void>;
    /**
     * Gets information about the current queryBuilderState.
     * This information can be used as a part of analytics
     */
    getStateInfo(): QueryableClassMappingRuntimeInfo | undefined;
    setIsQueryChatOpened(val: boolean): void;
    setIsLocalModeEnabled(val: boolean): void;
    setDataCubeViewerState(val: QueryBuilderDataCubeViewerState | undefined): void;
    setInternalize(val: QueryBuilderInternalizeState | undefined): void;
    setQueryChatState(val: QueryChatState | undefined): void;
    setShowFunctionsExplorerPanel(val: boolean): void;
    setShowParametersPanel(val: boolean): void;
    setIsEditingWatermark(val: boolean): void;
    setIsCheckingEntitlments(val: boolean): void;
    setIsCalendarEnabled(val: boolean): void;
    setClass(val: Class | undefined): void;
    setExecutionContextState(val: QueryBuilderExecutionContextState): void;
    setGetAllFunction(val: QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS): void;
    setINTERNAL__enableInitializingDefaultSimpleExpressionValue(val: boolean): void;
    get isQuerySupported(): boolean;
    openDataCubeEngine(): Promise<void>;
    registerCommands(): void;
    isVariableUsed(variable: VariableExpression, options?: {
        exculdeMilestoningState: boolean;
    }): boolean;
    deregisterCommands(): void;
    resetQueryResult(options?: {
        preserveResult?: boolean | undefined;
        gridConfig?: QueryGridConfig | undefined;
    }): void;
    resetQueryContent(): void;
    changeClass(val: Class): void;
    changeMapping(val: Mapping, options?: {
        keepQueryContent?: boolean;
    }): void;
    changeRuntime(val: Runtime): void;
    getCurrentParameterValues(): Map<string, ValueSpecification> | undefined;
    getGridConfig(): QueryGridConfig | undefined;
    buildQuery(options?: {
        keepSourceInformation: boolean;
    }): RawLambda;
    buildFromQuery(): RawLambda;
    /**
     * Builds the execution context expression (e.g. from()) for the lambda function.
     * Subclasses can override this to customize the execution context building.
     */
    buildExecutionContextExpression(lambdaFunction: LambdaFunction): LambdaFunction;
    getQueryReturnType(): Type;
    initializeWithQuery(query: RawLambda, defaultParameterValues?: Map<string, ValueSpecification>, gridConfig?: QueryGridConfig): void;
    /**
     * Process the provided query, and rebuild the query builder state.
     */
    rebuildWithQuery(query: RawLambda, options?: {
        preserveParameterValues?: boolean | undefined;
        preserveResult?: boolean | undefined;
        defaultParameterValues?: Map<string, ValueSpecification> | undefined;
    }): void;
    compileQuery(): GeneratorFn<void>;
    get allValidationIssues(): string[];
    get canBuildQuery(): boolean;
    buildFunctionAnalysisInfo(): QueryBuilderExtraFunctionAnalysisInfo | undefined;
    getGraphData(): GraphData;
    /**
     * This method can be used to simplify the current query builder state
     * to a basic one that can be used for testing or some special operations,
     * see {@link INTERNAL__BasicQueryBuilderState} for more details
     */
    INTERNAL__toBasicQueryBuilderState(): QueryBuilderState;
    get hashCode(): string;
}
/**
 * Base query builder state with result panel hidden.
 * This is useful for scenarios where the query builder is used
 * only for query construction without execution/result display.
 */
export declare abstract class BaseQueryBuilderState extends QueryBuilderState {
    get isResultPanelHidden(): boolean;
}
/**
 * This type is used for testing and analytics operation in query builder.
 * For example, we use this to build the preview data lambda, or to build the auto-complete lambda
 * in filters.
 *
 * NOTE: The latter is quite clever since query-builder itself is used to build the lambda (i.e. dogfooding),
 * unfortunately, it creates a circular dependency between QueryBuilderState and PreviewData/AutoComplete
 *
 * @internal
 */
export declare class INTERNAL__BasicQueryBuilderState extends QueryBuilderState {
}
//# sourceMappingURL=QueryBuilderState.d.ts.map