/**
 * 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 { EditorStore } from '../../../EditorStore.js';
import { MappingElementState } from './MappingElementState.js';
import { ElementEditorState } from '../../../editor-state/element-editor-state/ElementEditorState.js';
import { MAPPING_TEST_EDITOR_TAB_TYPE, MappingTestState, TEST_RESULT } from './MappingTestState.js';
import { type GeneratorFn } from '@finos/legend-shared';
import { MappingExecutionState } from './MappingExecutionState.js';
import type { TreeNodeData, TreeData } from '@finos/legend-art';
import { type CompilationError, type PackageableElement, type Type, Class, Enumeration, Mapping, EnumerationMapping, SetImplementation, MappingTest, InstanceSetImplementation, AssociationImplementation } from '@finos/legend-graph';
import type { MappingElementLabel } from '../../../DSLMapping_LegendStudioApplicationPlugin_Extension.js';
import type { LegendStudioApplicationPlugin } from '../../../LegendStudioApplicationPlugin.js';
import { BASIC_SET_IMPLEMENTATION_TYPE } from '../../../shared/ModelUtil.js';
export interface MappingExplorerTreeNodeData extends TreeNodeData {
    mappingElement: MappingElement;
}
export declare const generateMappingTestName: (mapping: Mapping) => string;
export declare enum MAPPING_ELEMENT_SOURCE_ID_LABEL {
    ENUMERATION_MAPPING = "enumerationMapping",
    OPERATION_CLASS_MAPPING = "operationClassMapping",
    PURE_INSTANCE_CLASS_MAPPING = "pureInstanceClassMapping",
    FLAT_DATA_CLASS_MAPPING = "flatDataClassMapping",
    RELATIONAL_CLASS_MAPPING = "relationalClassMapping",
    AGGREGATION_AWARE_CLASS_MAPPING = "aggregationAwareClassMapping"
}
export declare enum MAPPING_ELEMENT_TYPE {
    CLASS = "CLASS",
    ENUMERATION = "ENUMERATION",
    ASSOCIATION = "ASSOCIATION"
}
export declare type MappingElement = EnumerationMapping | SetImplementation | AssociationImplementation;
/**
 * Mapping element source could be just about anything, even `undefined`
 * We cannot really extend this type since it hinders modularity
 */
export declare type MappingElementSource = unknown;
export declare const getMappingElementTarget: (mappingElement: MappingElement) => PackageableElement;
export declare const getMappingElementLabel: (mappingElement: MappingElement, editorStore: EditorStore) => MappingElementLabel;
export declare const getMappingElementSource: (mappingElement: MappingElement, plugins: LegendStudioApplicationPlugin[]) => MappingElementSource | undefined;
export declare const getMappingElementType: (mappingElement: MappingElement) => MAPPING_ELEMENT_TYPE;
export declare const createClassMapping: (mapping: Mapping, id: string, _class: Class, setImpType: BASIC_SET_IMPLEMENTATION_TYPE, editorStore: EditorStore) => SetImplementation | undefined;
export declare const createEnumerationMapping: (mapping: Mapping, id: string, enumeration: Enumeration, sourceType: Type) => EnumerationMapping;
export declare const getEmbeddedSetImplementations: (setImpl: InstanceSetImplementation) => InstanceSetImplementation[];
export declare const getAllMappingElements: (mapping: Mapping) => MappingElement[];
export interface MappingElementSpec {
    showTarget: boolean;
    openInAdjacentTab: boolean;
    target?: PackageableElement | undefined;
    postSubmitAction?: (newMappingElement: MappingElement | undefined) => void;
}
export declare type MappingEditorTabState = MappingElementState | MappingTestState | MappingExecutionState;
export declare class MappingEditorState extends ElementEditorState {
    currentTabState?: MappingEditorTabState | undefined;
    openedTabStates: MappingEditorTabState[];
    mappingExplorerTreeData: TreeData<MappingExplorerTreeNodeData>;
    newMappingElementSpec?: MappingElementSpec | undefined;
    mappingTestStates: MappingTestState[];
    isRunningAllTests: boolean;
    allTestRunTime: number;
    constructor(editorStore: EditorStore, element: PackageableElement);
    get mapping(): Mapping;
    /**
     * This method is used to check if a target is being mapped multiple times, so we can make
     * decision on things like whether we enforce the user to provide an ID for those mapping elements.
     */
    get mappingElementsWithSimilarTarget(): MappingElement[];
    setNewMappingElementSpec(spec: MappingElementSpec | undefined): void;
    openTab(tabState: MappingEditorTabState): GeneratorFn<void>;
    closeTab(tabState: MappingEditorTabState): GeneratorFn<void>;
    closeAllOtherTabs(tabState: MappingEditorTabState): GeneratorFn<void>;
    closeAllTabs(): void;
    setMappingExplorerTreeNodeData(data: TreeData<MappingExplorerTreeNodeData>): void;
    onMappingExplorerTreeNodeExpand: (node: MappingExplorerTreeNodeData) => void;
    onMappingExplorerTreeNodeSelect: (node: MappingExplorerTreeNodeData) => void;
    getMappingExplorerTreeChildNodes: (node: MappingExplorerTreeNodeData) => MappingExplorerTreeNodeData[];
    reprocessMappingExplorerTree(openNodeFoCurrentTab?: boolean): void;
    openMappingElement(mappingElement: MappingElement, openInAdjacentTab: boolean): void;
    changeClassMappingSourceDriver(setImplementation: InstanceSetImplementation, newSource: MappingElementSource | undefined): GeneratorFn<void>;
    private closeMappingElementTabState;
    deleteMappingElement(mappingElement: MappingElement): GeneratorFn<void>;
    /**
     * This will determine if we need to show the new mapping element modal or not
     */
    createMappingElement(spec: MappingElementSpec): void;
    private createMappingElementState;
    reprocess(newElement: Mapping, editorStore: EditorStore): MappingEditorState;
    revealCompilationError(compilationError: CompilationError): boolean;
    get hasCompilationError(): boolean;
    clearCompilationError(): void;
    buildExecution(setImpl: SetImplementation): GeneratorFn<void>;
    openTest(test: MappingTest, openTab?: MAPPING_TEST_EDITOR_TAB_TYPE): GeneratorFn<void>;
    get testSuiteResult(): TEST_RESULT;
    runTests(): GeneratorFn<void>;
    addTest(test: MappingTest): GeneratorFn<void>;
    deleteTest(test: MappingTest): GeneratorFn<void>;
    createNewTest(setImplementation: SetImplementation): GeneratorFn<void>;
}
//# sourceMappingURL=MappingEditorState.d.ts.map