import store from "@/store";
import * as experimentHelper from "../helpers/experiment-helper";

/*
    This is a wrapper around experiment-helper.js methods that allows an override
      to provide a custom list of experiments. At the time of implementation this
      was necessary for checking submittedState for experiments
*/

export default {
    methods: {
        hasSettingEqualTo(
            settingName,
            settingValue,
            experimentList = store.getters.applicationUser.experiments
        ) {
            const experimentSettings =
                experimentHelper.getExperimentSettingsFromExperimentList(experimentList);
            return experimentHelper.hasSettingEqualTo(
                settingName,
                settingValue,
                experimentSettings
            );
        },
        hasSetting(settingName, experimentList = store.getters.applicationUser.experiments) {
            const experimentSettings =
                experimentHelper.getExperimentSettingsFromExperimentList(experimentList);
            return experimentHelper.hasSetting(settingName, experimentSettings);
        },
        getSettingValue(settingName, experimentList = store.getters.applicationUser.experiments) {
            const experimentSettings =
                experimentHelper.getExperimentSettingsFromExperimentList(experimentList);
            return experimentHelper.getSettingValue(settingName, experimentSettings);
        },
    },
};
