import { baseUniDriverFactory } from '../utils/test-utils/unidriver';
import { buttonDriverFactory, } from '../Button/Button.uni.driver';
import { tooltipDriverFactory } from '../Tooltip/Tooltip.uni.driver';
import { dataHooks } from './constants';
import { getFormattedDataHooks } from '../utils/test-utils';
const fDataHooks = getFormattedDataHooks(dataHooks);
export const baseModalLayoutDriverFactory = (base, body) => {
    const getButtonDriver = (dataHook) => {
        return buttonDriverFactory(base.$(`[data-hook-internal="${dataHook}"]`));
    };
    return {
        ...baseUniDriverFactory(base),
        /**
         * Gets the modal theme
         */
        getTheme: async () => base.attr('data-skin'),
        /**
         * Gets the modal skin
         */
        getSkin: async () => base.attr('data-skin'),
        /**
         * Clicks the modal close-button
         */
        clickCloseButton: async () => base.$(fDataHooks.closeButton).click(),
        /**
         * Clicks the modal help-button
         */
        clickHelpButton: async () => base.$(fDataHooks.helpButton).click(),
        /**
         * Checks whether a node with the provided dataHook exists
         */
        childExists: async (dataHook) => base.$(`[data-hook="${dataHook}"]`).exists() ||
            base.$(`[data-hook-internal="${dataHook}"]`).exists(),
        /**
         * Gets the title's text
         */
        getTitleText: async () => base.$(fDataHooks.headerTitle).text(),
        /**
         * Gets the subtitle's text
         */
        getSubtitleText: async () => base.$(fDataHooks.headerSubtitle).text(),
        /**
         * Gets the secondary button driver
         */
        secondaryButtonDriver: getButtonDriver(dataHooks.footerSecondaryButton),
        /**
         * @deprecated use secondaryButtonDriver
         * Gets the secondary button driver
         */
        getSecondaryButtonDriver: async () => getButtonDriver(dataHooks.footerSecondaryButton),
        /**
         * Gets the primary button driver
         */
        primaryButtonDriver: getButtonDriver(dataHooks.footerPrimaryButton),
        /**
         * @deprecated use primaryButtonDriver
         * Gets the primary button driver
         */
        getPrimaryButtonDriver: async () => getButtonDriver(dataHooks.footerPrimaryButton),
        /**
         * Gets the primary button's tooltip content
         */
        getPrimaryButtonTooltipContent: async () => {
            const tooltipDriver = tooltipDriverFactory(base.$(fDataHooks.primaryButtonTooltip), body ?? base);
            return tooltipDriver.getTooltipText();
        },
        /**
         * Gets the illustration source
         */
        getIllustrationSrc: async () => base.$(fDataHooks.illustrationSrc).attr('src'),
    };
};
//# sourceMappingURL=BaseModalLayout.uni.driver.js.map