import { Stack } from "@carbon/react";
import React from "react";
import { RadioGroupElementSingle } from "./elements/radioGroupSingle";
import { RadioGroupElementMulti } from "./elements/radioGroupMulti";
import { TextInputElement } from "./elements/textField";
import { DropdownSelect } from "./elements/dropdownSelect";
import { OnboardingQuestionType } from "./onboarding.types";
export const OnboardingStep = ({ theme, config, generic, setGeneric, }) => {
    return (React.createElement(Stack, { gap: 6 }, (() => {
        if (!config?.elements) {
            return React.createElement(React.Fragment, null);
        }
        return config?.elements.map((element, index) => {
            switch (element.type) {
                case OnboardingQuestionType.TileSingleSelect:
                    return (React.createElement(RadioGroupElementSingle, { theme: theme, tooltip: element.tooltip, elements: element.elements, selectedElement: generic(element.mapto), setSelectedElement: (e) => {
                            setGeneric(element.mapto, e);
                        }, title: element.title, label: element.label, columns: element.columns, key: `onboarding-step-element-${index}` }));
                case OnboardingQuestionType.TileMultiSelect:
                    return (React.createElement(RadioGroupElementMulti, { theme: theme, tooltip: element.tooltip, elements: element.elements, selectedElements: generic(element.mapto) ?? [], setSelectedElements: (e) => {
                            setGeneric(element.mapto, e);
                        }, title: element.title, label: element.label, columns: element.columns, key: `onboarding-step-element-${index}` }));
                case OnboardingQuestionType.DropdownSelect:
                    return (React.createElement(DropdownSelect, { tooltip: element.tooltip, elements: element.elements, selectedElement: generic(element.mapto), setSelectedElement: (e) => {
                            setGeneric(element.mapto, e);
                        }, title: element.title, label: element.label, columns: element.columns, exceptionTitle: element.exceptiontextinput?.title, exceptionLabel: element.exceptiontextinput?.label, exceptionValue: element.exceptiontextinput?.forvalue, key: `onboarding-step-element-${index}` }));
                case OnboardingQuestionType.TextInput:
                    return (React.createElement(TextInputElement, { title: element.title, label: element.label, preFiledValue: generic(element.mapto), setValue: (value) => {
                            setGeneric(element.mapto, value);
                        }, placeholder: "Your company\u2019s name", key: `onboarding-step-element-${index}` }));
                default:
                    return React.createElement(React.Fragment, null);
            }
        });
    })()));
};
