"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.processOptions = processOptions;
const orval_events_1 = require("../../../events/api/orval/api/orval-events");
/**
 * Builds a Partial<ISearchEvents> for the given IHubSearchOptions
 * @param options An IHubSearchOptions object
 * @returns a Partial<ISearchEvents> for the given IHubSearchOptions
 */
function processOptions(options) {
    const processedOptions = {};
    if (options.num > 0) {
        processedOptions.num = options.num;
    }
    if (options.start > 1) {
        processedOptions.start = options.start;
    }
    if (options.sortField === "modified") {
        processedOptions.sortBy = orval_events_1.EventSort.updatedAt;
    }
    else if (options.sortField === "created") {
        processedOptions.sortBy = orval_events_1.EventSort.createdAt;
    }
    else if (options.sortField === "title") {
        processedOptions.sortBy = orval_events_1.EventSort.title;
    }
    else if (options.sortField === "startDate") {
        processedOptions.sortBy = orval_events_1.EventSort.startDateTime;
    }
    processedOptions.sortOrder =
        options.sortOrder === "desc" ? orval_events_1.EventSortOrder.desc : orval_events_1.EventSortOrder.asc;
    return processedOptions;
}
//# sourceMappingURL=processOptions.js.map