import {
  NumberInputUniDriver,
  RadioGroupUniDriver,
  SegmentedToggleUniDriver,
  TabsUniDriver,
  ThumbnailUniDriver,
  ToggleSwitchUniDriver
} from "@wix/design-system/dist/testkit/unidriver.js";
import { dataHook } from "./../../wix-rich-content-common/index.js";
import { createFooterActionsUnidriver } from "./../../ui-components/testkit.js";
import {
  DESIGN_SETTINGS_ANSWERS_CORNER_RADIUS_INPUT,
  DESIGN_SETTINGS_BACKGROUND_THUMBNAIL,
  DESIGN_SETTINGS_CORNER_RADIUS_INPUT,
  GENERAL_SETTINGS_EACH_PERSON_VOTE_TOGGLE,
  GENERAL_SETTINGS_MULTIPLE_ANSWERS_TOGGLE,
  GENERAL_SETTINGS_VIEW_PERMISSIONS_RADIO_GROUP,
  GENERAL_SETTINGS_VOTE_COUNT_TOGGLE,
  GENERAL_SETTINGS_VOTE_PERMISSIONS_RADIO_GROUP,
  LAYOUT_SETTINGS_DIRECTION_TOGGLE,
  LAYOUT_SETTINGS_IMAGE_TO_ANSWERS_TOGGLE,
  LAYOUT_SETTINGS_IMAGE_TO_QUESTION_TOGGLE,
  LAYOUT_SETTINGS_LAYOUT_THUMBNAIL,
  SETTINGS_MODAL,
  SETTINGS_TABS
} from "../data-hooks.js";
const createPollsSettingsUniDriver = (getBase) => {
  return {
    waitForElement: async () => {
      const settings = await getBase().get(dataHook(SETTINGS_MODAL));
      await settings.wait();
    },
    tabs: TabsUniDriver(getBase().$(dataHook(SETTINGS_TABS)), getBase()),
    layoutTab: {
      click: async () => {
        const tabs = TabsUniDriver(getBase().$(dataHook(SETTINGS_TABS)), getBase());
        await tabs.clickTabAt(0);
      },
      enablePollImageToggle: ToggleSwitchUniDriver(
        getBase().$(dataHook(LAYOUT_SETTINGS_IMAGE_TO_QUESTION_TOGGLE)),
        getBase()
      ),
      getPollLayoutThumbnail: async (type) => {
        const settings = await getBase().get(dataHook(SETTINGS_MODAL));
        const selectedLayout = await settings.get(
          dataHook(LAYOUT_SETTINGS_LAYOUT_THUMBNAIL + type)
        );
        return ThumbnailUniDriver(selectedLayout, getBase());
      },
      enableOptionsImageToggle: ToggleSwitchUniDriver(
        getBase().$(dataHook(LAYOUT_SETTINGS_IMAGE_TO_ANSWERS_TOGGLE)),
        getBase()
      ),
      directionSegmentedToggle: SegmentedToggleUniDriver(
        getBase().$(dataHook(LAYOUT_SETTINGS_DIRECTION_TOGGLE)),
        getBase()
      )
    },
    designTab: {
      click: async () => {
        const tabs = TabsUniDriver(getBase().$(dataHook(SETTINGS_TABS)), getBase());
        await tabs.clickTabAt(1);
      },
      getBackgroundStyleThumbnail: async (type) => {
        const settings = await getBase().get(dataHook(SETTINGS_MODAL));
        const selectedStyle = await settings.get(
          dataHook(DESIGN_SETTINGS_BACKGROUND_THUMBNAIL + type)
        );
        return ThumbnailUniDriver(selectedStyle, getBase());
      },
      pollBorderRadiusInput: NumberInputUniDriver(
        getBase().$(dataHook(DESIGN_SETTINGS_CORNER_RADIUS_INPUT)),
        getBase()
      ),
      answersBorderRadiusInput: NumberInputUniDriver(
        getBase().$(dataHook(DESIGN_SETTINGS_ANSWERS_CORNER_RADIUS_INPUT)),
        getBase()
      )
    },
    settingsTab: {
      click: async () => {
        const tabs = TabsUniDriver(getBase().$(dataHook(SETTINGS_TABS)), getBase());
        await tabs.clickTabAt(2);
      },
      votePermissionsRadioGroup: RadioGroupUniDriver(
        getBase().$(dataHook(GENERAL_SETTINGS_VOTE_PERMISSIONS_RADIO_GROUP)),
        getBase()
      ),
      viewPermissionsRadioGroup: RadioGroupUniDriver(
        getBase().$(dataHook(GENERAL_SETTINGS_VIEW_PERMISSIONS_RADIO_GROUP)),
        getBase()
      ),
      allowMultipleAnswersToggle: ToggleSwitchUniDriver(
        getBase().$(dataHook(GENERAL_SETTINGS_MULTIPLE_ANSWERS_TOGGLE)),
        getBase()
      ),
      showVoteCountToggle: ToggleSwitchUniDriver(
        getBase().$(dataHook(GENERAL_SETTINGS_VOTE_COUNT_TOGGLE)),
        getBase()
      ),
      showVotedPersonToggle: ToggleSwitchUniDriver(
        getBase().$(dataHook(GENERAL_SETTINGS_EACH_PERSON_VOTE_TOGGLE)),
        getBase()
      )
    },
    ...createFooterActionsUnidriver(getBase)
  };
};
export {
  createPollsSettingsUniDriver
};
//# sourceMappingURL=social-polls-settings-tab.unidriver.js.map
