/* eslint-disable max-len */
import { experimentSettings } from '@/constants/experiments';

export function hasExperimentSetting(storeExperimentSettings, settingName) {
    return Object.hasOwn(storeExperimentSettings, settingName);
}

export function getExperimentSettingValue(storeExperimentSettings, settingName) {
    return hasExperimentSetting(storeExperimentSettings, settingName)
        ? storeExperimentSettings[settingName]
        : null;
}

export function getFeatureTogglesPayloadObject(storeExperimentSettings) {
    const isMobileFeeHidden = getExperimentSettingValue(storeExperimentSettings, experimentSettings.ISS_FEATURE_TOGGLE_IS_MOBILE_FEE_HIDDEN) === 'true';
    const isMobileFeeOverridden = getExperimentSettingValue(storeExperimentSettings, experimentSettings.ISS_FEATURE_TOGGLE_IS_MOBILE_FEE_OVERRIDDEN) === 'true';
    const isRecycleFeeHidden = getExperimentSettingValue(storeExperimentSettings, experimentSettings.ISS_FEATURE_TOGGLE_IS_RECYCLE_FEE_HIDDEN) === 'true';
    const isRecycleFeeOverridden = getExperimentSettingValue(storeExperimentSettings, experimentSettings.ISS_FEATURE_TOGGLE_IS_RECYCLE_FEE_OVERRIDDEN) === 'true';

    return {
        isMobileFeeHidden,
        isMobileFeeOverridden,
        isRecycleFeeHidden,
        isRecycleFeeOverridden
    };
}
