/**
 * 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 { observable, action, makeObservable } from 'mobx';
import { UnsupportedOperationError } from '@finos/legend-shared';
import { ElementEditorState } from './ElementEditorState.js';
import { Class, Profile, Association, Enumeration, } from '@finos/legend-graph';
export var UML_EDITOR_TAB;
(function (UML_EDITOR_TAB) {
    UML_EDITOR_TAB["TAGGED_VALUES"] = "TAGGED_VALUES";
    UML_EDITOR_TAB["STEREOTYPES"] = "STEREOTYPES";
    // Class & Association
    UML_EDITOR_TAB["PROPERTIES"] = "PROPERTIES";
    UML_EDITOR_TAB["PROPERTY_AGGREGATION"] = "PROPERTY_AGGREGATION";
    // Class
    UML_EDITOR_TAB["DERIVED_PROPERTIES"] = "DERIVED_PROPERTIES";
    UML_EDITOR_TAB["CONSTRAINTS"] = "CONSTRAINTS";
    UML_EDITOR_TAB["SUPER_TYPES"] = "SUPER_TYPES";
    // Enumeration
    UML_EDITOR_TAB["ENUM_VALUES"] = "VALUES";
    // Profile
    UML_EDITOR_TAB["TAGS"] = "TAGS";
})(UML_EDITOR_TAB || (UML_EDITOR_TAB = {}));
export class UMLEditorState extends ElementEditorState {
    selectedTab;
    constructor(editorStore, element) {
        super(editorStore, element);
        makeObservable(this, {
            selectedTab: observable,
            setSelectedTab: action,
            reprocess: action,
        });
        if (element instanceof Class) {
            this.selectedTab = UML_EDITOR_TAB.PROPERTIES;
        }
        else if (element instanceof Enumeration) {
            this.selectedTab = UML_EDITOR_TAB.ENUM_VALUES;
        }
        else if (element instanceof Profile) {
            this.selectedTab = UML_EDITOR_TAB.TAGS;
        }
        else if (element instanceof Association) {
            this.selectedTab = UML_EDITOR_TAB.PROPERTIES;
        }
        else {
            throw new UnsupportedOperationError(`Can't build UML editor state for element`, element);
        }
    }
    setSelectedTab(tab) {
        this.selectedTab = tab;
    }
    reprocess(newElement, editorStore) {
        const umlEditorState = new UMLEditorState(editorStore, newElement);
        umlEditorState.selectedTab = this.selectedTab;
        return umlEditorState;
    }
}
//# sourceMappingURL=UMLEditorState.js.map