import { ArrayValue, EnumValue, RecordValue, StringValue } from '@coveo/bueno';
export var SortBy;
(function (SortBy) {
    SortBy["Relevance"] = "relevance";
    SortBy["Fields"] = "fields";
})(SortBy || (SortBy = {}));
export var SortDirection;
(function (SortDirection) {
    SortDirection["Ascending"] = "asc";
    SortDirection["Descending"] = "desc";
})(SortDirection || (SortDirection = {}));
export const buildRelevanceSortCriterion = () => ({
    by: SortBy.Relevance,
});
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: {
                    name: new StringValue(),
                    direction: new EnumValue({ enum: SortDirection }),
                },
            }),
        }),
    },
});
