import { ArrayValue, EnumValue, RecordValue, StringValue } from '@coveo/bueno';
import { buildRelevanceSortCriterion, SortBy, SortDirection, } from '../../sort/sort.js';
export { buildRelevanceSortCriterion, SortBy, SortDirection };
/**
 * Builds a field sort criterion.
 *
 * @param fields - An array of fields to sort by.
 * @returns The sort criterion object.
 */
export const buildFieldsSortCriterion = (fields) => ({
    by: SortBy.Fields,
    fields,
});
export const sortCriterionDefinition = new RecordValue({
    options: {
        required: false,
    },
    values: {
        by: new EnumValue({ enum: SortBy, required: true }),
        fields: new ArrayValue({
            each: new RecordValue({
                values: {
                    field: new StringValue({ required: true }),
                    direction: new EnumValue({ enum: SortDirection }),
                    displayName: new StringValue(),
                },
            }),
        }),
    },
});
