import { baseUniDriverFactory, findByHook, } from '../utils/test-utils/unidriver';
import { badgeUniDriverFactory } from '../Badge/Badge.uni.driver';
import { popoverNextUniDriverFactory } from '../PopoverNext/PopoverNext.uni.driver';
import * as DATA_ATTR from './DataAttr';
import { dropdownLayoutDriverFactory } from '../DropdownLayout/DropdownLayout.uni.driver';
export const badgeSelectUniDriverFactory = (base, body) => {
    const popoverDriver = popoverNextUniDriverFactory(base, body);
    const badgeDriver = badgeUniDriverFactory(findByHook(base, DATA_ATTR.DATA_BADGE));
    return {
        ...baseUniDriverFactory(base),
        exists: () => popoverDriver.exists(),
        /**
         * Clicks an option at given index
         * @param {number} index Position of the option
         * @returns {Promise<void>}
         */
        clickAtOption: async (index) => {
            await badgeDriver.click();
            const popoverCommonTestkit = () => popoverNextUniDriverFactory(base, body);
            const contentElement = await popoverCommonTestkit().getContentElementUniDriver();
            const dropdownLayoutDriver = dropdownLayoutDriverFactory(contentElement.$(`[data-hook="${DATA_ATTR.DATA_DROPDOWN}"]`));
            await dropdownLayoutDriver.clickAtOption(index);
        },
        /**
         * Gets badge text
         * @return {Promise<string>}
         */
        text: badgeDriver.text,
        /**
         * Gets badge type
         * @return {Promise<'solid' | 'outlined' | 'transparent'>}
         */
        getType: badgeDriver.getType,
        /**
         * Gets badge type
         * @return {Promise<'general' | 'standard' | 'danger' | 'success' | 'neutral' | 'neutralLight' | 'warning' | 'warningLight' | 'urgent' | 'neutralStandard' | 'neutralSuccess' | 'neutralDanger' | 'premium'>}
         */
        getSkin: badgeDriver.getSkin,
        /**
         * Gets badge size
         * @return {Promise<'medium' | 'small'>}
         */
        getSize: badgeDriver.getSize,
        /**
         * Checks whether the text is uppercase
         * @return {Promise<boolean>}
         */
        isUppercase: badgeDriver.isUppercase,
        /**
         * Checks whether badge is clickable
         * @return {Promise<boolean>}
         */
        hasClickCursor: badgeDriver.hasClickCursor,
    };
};
export default badgeSelectUniDriverFactory;
//# sourceMappingURL=BadgeSelect.uni.driver.js.map