import { EnumValue } from '@coveo/bueno';
import { createAction } from '@reduxjs/toolkit';
import { validatePayload } from '../../utils/validate-payload.js';
import { SortBy } from './sort.js';
const criterionDefinition = {
    by: new EnumValue({
        enum: SortBy,
        required: true,
    }),
};
export const registerSortCriterion = createAction('sort/register', (payload) => validate(payload));
export const updateSortCriterion = createAction('sort/update', (payload) => validate(payload));
const validate = (payload) => validatePayload(payload, criterionDefinition);
