export const setProperties = (widgetList, type) => {
  // console.log("set properties", widgetList);
  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,
      };
      // console.log("elem", 'padding null');
    }

    // console.log("elem", elem.style.padding.top);
    // console.log("check", value === "widimage" || value === "image_widget");
    if (value === "widimage" || value === "image_widget") {
      elem.type = "image_widget";
      elem.properties = [
        "action-properties",
        "color-properties",
        "image-properties",
        "general-properties",
      ];
    } else if (value === "widsocials" || value === "socials_widget") {
      elem.type = "socials_widget";
      elem.properties = [];
    } else if (value === "widlinks" || value === "links_widget") {
      elem.type = "links_widget";
      elem.properties = [];
    } else if (value === "widtext" || value === "text_widget") {
      elem.type = "text_widget";
      elem.properties = [
        "color-properties",
        "text-editor",
        "general-properties",
      ];
    } else if (value === "single_input" || value === "single_input_widget") {
      elem.type = "single_input_widget";
      elem.properties = [
        "color-properties",
        "text-properties",
        "FormDesign",
        "general-properties",
      ];
    } else if (value === "text_area" || value === "text_area_widget") {
      elem.type = "text_area_widget";
      elem.properties = [
        "color-properties",
        "text-properties",
        "form-design",
        "general-properties",
      ];
    } else if (value === "widdate" || value === "date_widget") {
      elem.type = "date_widget";
      elem.properties = [];
    } else if (value === "widtime" || value === "time_widget") {
      elem.type = "time_widget";
      elem.properties = [];
    } else if (value === "checkbox" || value === "checkbox_widget") {
      elem.type = "checkbox_widget";
      elem.properties = [
        "color-properties",
        "text-properties",
        "form-design",
        "general-properties",
      ];
    } else if (value === "radiogroup" || value === "radiogroup_widget") {
      elem.type = "radiogroup_widget";
      elem.properties = [
        "color-properties",
        "text-properties",
        "form-design",
        "general-properties",
      ];
    } else if (value === "ratting" || value === "ratting_widget") {
      elem.type = "ratting_widget";
      elem.properties = [
        "color-properties",
        "text-properties",
        "general-properties",
      ];
    } else if (value === "boolean" || value === "boolean_widget") {
      elem.type = "boolean_widget";
      elem.properties = [
        "color-properties",
        "text-properties",
        "general-properties",
      ];
    } else if (value === "file" || value === "file_upload_widget") {
      elem.type = "file_upload_widget";
      elem.properties = [
        "color-properties",
        "text-properties",
        "general-properties",
      ];
    } else if (value === "slider" || value === "slider_widget") {
      elem.type = "slider_widget";
      elem.properties = [];
    } else if (value === "submitBtn" || value === "submit_button_widget") {
      elem.type = "submit_button_widget";
      elem.properties = [
        "color-properties",
        "button-properties",
        "general-properties",
      ];
    } else if (value === "dropdown" || value === "dropdown_widget") {
      elem.type = "dropdown_widget";
      elem.properties = [
        "color-properties",
        "text-properties",
        "general-properties",
      ];
    } else if (value === "groups_widget") {
      elem.properties = [
        "color-properties",
        "text-properties",
        "general-properties",
      ];
    } else if (value === "camraRecord") {
      elem.type = "camraRecord";
      elem.properties = [];
    } else if (value === "voice_record_widget") {
      elem.type = "voice_record_widget";
      elem.properties = [];
    } else if (value === "youtube_widget") {
      elem.type = "youtube_widget";
      elem.properties = ["text-properties", "general-properties"];
    } else if (value === "image_slider_widget") {
      elem.type = "image_slider_widget";
      elem.properties = [
        "text-properties",
        "color-properties",
        "image-properties",
        "general-properties",
      ];
    }
  });
};
