import { UniDriver } from '@wix/wix-ui-test-utils/unidriver';
import { baseUniDriverFactory } from '../../unidriver';
import {
  RadioGroupUniDriver,
  RadioUniDriver,
} from '@wix/design-system/dist/testkit/unidriver';

export function RadioGroupFilterUniDriver(base: UniDriver, body: UniDriver) {
  const getRadioGroup = () =>
    RadioGroupUniDriver(base.$(`[data-hook="radio-group-filter-group"]`), body);

  const getRadioItem = (value: any) =>
    RadioUniDriver(
      base.$(`[data-hook="radio-group-filter-option-${value}"]`),
      body,
    );
  const getSelectedItem = async () => {
    return getRadioGroup().getSelectedValue();
  };

  return {
    ...baseUniDriverFactory(base),
    getRadioGroup,
    getRadioItem,
    getSelectedItem,
  };
}
