"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const _1 = require(".");
const process_engine_contracts_1 = require("@process-engine/process_engine_contracts");
const start_event_handler_1 = require("./start_event_handler");
const end_event_handler_1 = require("./end_event_handler");
const exlusive_gateway_handler_1 = require("./exlusive_gateway_handler");
const service_task_handler_1 = require("./service_task_handler");
const parallel_gateway_handler_1 = require("./parallel_gateway_handler");
const error_boundary_event_handler_1 = require("./error_boundary_event_handler");
class FlowNodeHandlerFactory {
    constructor(container, invoker, datastoreService) {
        this.container = container;
        this.invoker = invoker;
        this.datastoreService = datastoreService;
    }
    create(flowNodeTypeName) {
        switch (flowNodeTypeName) {
            case process_engine_contracts_1.BpmnType.startEvent:
                return new start_event_handler_1.StartEventHandler();
            case process_engine_contracts_1.BpmnType.exclusiveGateway:
                return new exlusive_gateway_handler_1.ExclusiveGatewayHandler();
            case process_engine_contracts_1.BpmnType.parallelGateway:
                return new parallel_gateway_handler_1.ParallelGatewayHandler(this, this.datastoreService);
            case process_engine_contracts_1.BpmnType.serviceTask:
                return new service_task_handler_1.ServiceTaskHandler(this.container, this.invoker);
            case process_engine_contracts_1.BpmnType.scriptTask:
                return new error_boundary_event_handler_1.ErrorBoundaryEventHandler(new _1.ScriptTaskHandler());
            case process_engine_contracts_1.BpmnType.intermediateCatchEvent:
                return new _1.IntermedtiateCatchEventHandler();
            case process_engine_contracts_1.BpmnType.endEvent:
                return new end_event_handler_1.EndEventHandler();
            default:
                throw Error(`Es konnte kein FlowNodeHandler für den FlowNodeType ${flowNodeTypeName} gefunden werden.`);
        }
    }
}
exports.FlowNodeHandlerFactory = FlowNodeHandlerFactory;

//# sourceMappingURL=flow_node_handler_factory.js.map
