import { facetDeselect, facetExclude, facetSelect, facetUnexclude, logFacetDeselect, logFacetExclude, logFacetSelect, logFacetUnexclude, } from '../../facet-set/facet-set-analytics-actions.js';
export const isRangeFacetValueSelected = (selection) => {
    return selection.state === 'selected';
};
export const isRangeFacetValueExcluded = (selection) => {
    return selection.state === 'excluded';
};
export const getLegacyAnalyticsActionForToggleRangeFacetSelect = (facetId, selection) => {
    const facetValue = `${selection.start}..${selection.end}`;
    const payload = { facetId, facetValue };
    return isRangeFacetValueSelected(selection)
        ? logFacetDeselect(payload)
        : logFacetSelect(payload);
};
export const getAnalyticsActionForToggleFacetSelect = (selection) => {
    return isRangeFacetValueSelected(selection) ? facetDeselect() : facetSelect();
};
export const getLegacyAnalyticsActionForToggleRangeFacetExclude = (facetId, selection) => {
    const facetValue = `${selection.start}..${selection.end}`;
    const payload = { facetId, facetValue };
    return isRangeFacetValueExcluded(selection)
        ? logFacetUnexclude(payload)
        : logFacetExclude(payload);
};
export const getAnalyticsActionForToggleRangeFacetExclude = (selection) => {
    return isRangeFacetValueExcluded(selection)
        ? facetUnexclude()
        : facetExclude();
};
