export const setProperties = (widgetList, type) => {
  return widgetList.forEach((elem) => {
    let value = elem[type];

    if (elem.style.padding.top == null) {
      elem.style.padding = {
        top: 10,
        bottom: 10,
        right: 10,
        left: 10,
      };
    }
    elem.type = value;
    if (value === "ImageWidget") {
      elem.type = value;
      elem.properties = [
        "ColorProperties",
        "ActionProperties",
        "ImageProperties",
        "GeneralProperties",
      ];
    } else if (value === "TemplateStyle") {
      elem.properties = ["TemplateStyleProperties"];
    } else if (value === "TextEditorWidget") {
      elem.properties = [
        "ColorProperties",
        "TextEditorProperties",
        "GeneralProperties",
      ];
    } else if (value === "TextInputWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        // "FormDesign",
        "GeneralProperties",
      ];
    } else if (value === "TextInputMultiLineWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "FormProperties",
        "GeneralProperties",
      ];
    } else if (value === "CheckboxWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "FormProperties",
        "GeneralProperties",
      ];
    } else if (value === "RadioButtonWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "FormProperties",
        "GeneralProperties",
      ];
    } else if (value === "RattingWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "GeneralProperties",
      ];
    } else if (value === "BooleanWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "GeneralProperties",
      ];
    } else if (value === "UploadWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "GeneralProperties",
      ];
    } else if (value === "SubmitButtonWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "button-properties",
        "GeneralProperties",
      ];
    } else if (value === "DropdownWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "GeneralProperties",
      ];
    } else if (value === "GroupsWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "GeneralProperties",
      ];
    } else if (value === "YoutubeWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "GeneralProperties",
      ];
    } else if (value === "ImageCarouselWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "ImageProperties",
        "GeneralProperties",
      ];
    } else if (value === "VoiceWidget") {
      elem.properties = ["ColorProperties", "GeneralProperties"];
    } else if (
      value === "SmileyFaceSliderWidget" ||
      value === "NumberSliderWidget"
    ) {
      elem.properties = ["ColorProperties", "GeneralProperties"];
    } else if (value === "FooterCopyrightWidget") {
      elem.properties = [
        "ColorProperties",
        "InputProperties",
        "GeneralProperties",
      ];
    }
  });
};
