import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
/**
 * 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 { PanelContent, PURE_ConnectionIcon, PURE_UnknownElementTypeIcon, } from '@finos/legend-art';
import { observer } from 'mobx-react-lite';
import {} from '../../../../stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js';
import { LEGEND_STUDIO_TEST_ID } from '../../../../__lib__/LegendStudioTesting.js';
import { END_TO_END_WORKFLOWS } from '../../../../stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.js';
import { prettyCONSTName } from '@finos/legend-shared';
export const getWorkflowIcon = (currentFlow) => {
    if (currentFlow === END_TO_END_WORKFLOWS.CREATE_QUERY_FROM_CONNECTION) {
        return (_jsx("div", { title: "Create Query From Connection", className: "icon icon--connection color--connection", children: _jsx(PURE_ConnectionIcon, {}) }));
    }
    else {
        return (_jsx("div", { title: "Query From Workflow", className: "icon", children: _jsx(PURE_UnknownElementTypeIcon, {}) }));
    }
};
export const EndToEndWorkflow = observer((props) => {
    const { globalEndToEndWorkflowState } = props;
    const openWorkflow = (event, flow) => {
        event.stopPropagation();
        event.preventDefault();
        globalEndToEndWorkflowState.visitWorkflow(flow);
    };
    const endToEndWorkflow = () => (_jsx(_Fragment, { children: Object.values(END_TO_END_WORKFLOWS).map((flow) => (_jsx("div", { className: "side-bar__panel__item", children: _jsxs("div", { className: "end-to-end-workflow__container", onClick: (event) => {
                    openWorkflow(event, flow);
                }, children: [_jsx("div", { className: "end-to-end-workflow__container__icon", children: getWorkflowIcon(flow) }), _jsx("div", { className: "end-to-end-workflow__container__name", children: prettyCONSTName(flow) })] }) }, flow))) }));
    return (_jsxs("div", { "data-testid": LEGEND_STUDIO_TEST_ID.END_TO_END_WORKFLOW, className: "panel", children: [_jsx("div", { className: "panel__header side-bar__header", children: _jsx("div", { className: "panel__header__title", children: _jsx("div", { className: "panel__header__title__content side-bar__header__title__content", children: "Guided End to End Workflows" }) }) }), _jsx("div", { className: "panel__content side-bar__content", children: _jsx("div", { className: "panel side-bar__panel", children: _jsx(PanelContent, { children: endToEndWorkflow() }) }) })] }));
});
//# sourceMappingURL=EndToEndWorkflows.js.map