"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDefaultEdgeTypeHint = exports.createDefaultShapeTypeHint = exports.WorkflowDiagramConfiguration = void 0;
/********************************************************************************
 * Copyright (c) 2022-2023 STMicroelectronics and others.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 *
 * This Source Code may also be made available under the following Secondary
 * Licenses when the conditions for such availability set forth in the Eclipse
 * Public License v. 2.0 are satisfied: GNU General Public License, version 2
 * with the GNU Classpath Exception which is available at
 * https://www.gnu.org/software/classpath/license.html.
 *
 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
 ********************************************************************************/
const protocol_1 = require("@eclipse-glsp/protocol");
const server_1 = require("@eclipse-glsp/server");
const inversify_1 = require("inversify");
const graph_extension_1 = require("./graph-extension");
const model_types_1 = require("./util/model-types");
let WorkflowDiagramConfiguration = class WorkflowDiagramConfiguration {
    constructor() {
        this.layoutKind = server_1.ServerLayoutKind.MANUAL;
        this.needsClientLayout = true;
        this.animatedUpdate = true;
    }
    get typeMapping() {
        const mapping = (0, server_1.getDefaultMapping)();
        mapping.set(model_types_1.ModelTypes.LABEL_HEADING, server_1.GLabel);
        mapping.set(model_types_1.ModelTypes.LABEL_TEXT, server_1.GLabel);
        mapping.set(model_types_1.ModelTypes.COMP_HEADER, server_1.GCompartment);
        mapping.set(model_types_1.ModelTypes.LABEL_ICON, server_1.GLabel);
        mapping.set(model_types_1.ModelTypes.WEIGHTED_EDGE, server_1.GEdge);
        mapping.set(model_types_1.ModelTypes.ICON, server_1.GCompartment);
        mapping.set(model_types_1.ModelTypes.ACTIVITY_NODE, graph_extension_1.ActivityNode);
        mapping.set(model_types_1.ModelTypes.TASK, graph_extension_1.TaskNode);
        mapping.set(model_types_1.ModelTypes.CATEGORY, graph_extension_1.Category);
        mapping.set(model_types_1.ModelTypes.STRUCTURE, server_1.GCompartment);
        return mapping;
    }
    get shapeTypeHints() {
        return [
            createDefaultShapeTypeHint(model_types_1.ModelTypes.MANUAL_TASK),
            createDefaultShapeTypeHint(model_types_1.ModelTypes.AUTOMATED_TASK),
            createDefaultShapeTypeHint(model_types_1.ModelTypes.FORK_NODE),
            createDefaultShapeTypeHint(model_types_1.ModelTypes.JOIN_NODE),
            createDefaultShapeTypeHint(model_types_1.ModelTypes.DECISION_NODE),
            createDefaultShapeTypeHint(model_types_1.ModelTypes.MERGE_NODE),
            {
                elementTypeId: model_types_1.ModelTypes.CATEGORY,
                repositionable: true,
                deletable: true,
                resizable: true,
                reparentable: true,
                containableElementTypeIds: [
                    model_types_1.ModelTypes.DECISION_NODE,
                    model_types_1.ModelTypes.MERGE_NODE,
                    model_types_1.ModelTypes.FORK_NODE,
                    model_types_1.ModelTypes.JOIN_NODE,
                    model_types_1.ModelTypes.AUTOMATED_TASK,
                    model_types_1.ModelTypes.MANUAL_TASK,
                    model_types_1.ModelTypes.CATEGORY
                ]
            }
        ];
    }
    get edgeTypeHints() {
        return [
            createDefaultEdgeTypeHint(protocol_1.DefaultTypes.EDGE),
            {
                elementTypeId: model_types_1.ModelTypes.WEIGHTED_EDGE,
                repositionable: true,
                deletable: true,
                routable: true,
                sourceElementTypeIds: [model_types_1.ModelTypes.DECISION_NODE],
                targetElementTypeIds: [model_types_1.ModelTypes.MANUAL_TASK, model_types_1.ModelTypes.AUTOMATED_TASK, model_types_1.ModelTypes.FORK_NODE, model_types_1.ModelTypes.JOIN_NODE]
            }
        ];
    }
};
WorkflowDiagramConfiguration = __decorate([
    (0, inversify_1.injectable)()
], WorkflowDiagramConfiguration);
exports.WorkflowDiagramConfiguration = WorkflowDiagramConfiguration;
function createDefaultShapeTypeHint(elementId) {
    return { elementTypeId: elementId, repositionable: true, deletable: true, resizable: true, reparentable: true };
}
exports.createDefaultShapeTypeHint = createDefaultShapeTypeHint;
function createDefaultEdgeTypeHint(elementId) {
    return {
        elementTypeId: elementId,
        repositionable: true,
        deletable: true,
        routable: true,
        sourceElementTypeIds: [
            model_types_1.ModelTypes.MANUAL_TASK,
            model_types_1.ModelTypes.AUTOMATED_TASK,
            model_types_1.ModelTypes.DECISION_NODE,
            model_types_1.ModelTypes.MERGE_NODE,
            model_types_1.ModelTypes.FORK_NODE,
            model_types_1.ModelTypes.JOIN_NODE,
            model_types_1.ModelTypes.CATEGORY
        ],
        targetElementTypeIds: [
            model_types_1.ModelTypes.MANUAL_TASK,
            model_types_1.ModelTypes.AUTOMATED_TASK,
            model_types_1.ModelTypes.DECISION_NODE,
            model_types_1.ModelTypes.MERGE_NODE,
            model_types_1.ModelTypes.FORK_NODE,
            model_types_1.ModelTypes.JOIN_NODE,
            model_types_1.ModelTypes.CATEGORY
        ]
    };
}
exports.createDefaultEdgeTypeHint = createDefaultEdgeTypeHint;
//# sourceMappingURL=workflow-diagram-configuration.js.map