import { ChannelRelation } from "../../../discussions/api/enums/channelRelation";
import { ChannelSort } from "../../../discussions/api/enums/channelSort";
import { SortOrder } from "../../../discussions/api/enums/sortOrder";
const SORT_FIELD_MAP = {
    access: ChannelSort.ACCESS,
    created: ChannelSort.CREATED_AT,
    modified: ChannelSort.UPDATED_AT,
    owner: ChannelSort.CREATOR,
    lastActivity: ChannelSort.LAST_ACTIVITY,
};
const SORT_ORDER_MAP = {
    desc: SortOrder.DESC,
    asc: SortOrder.ASC,
};
/**
 * @private
 * Converts an IHubSearchOptions object into a partial ISearchChannels
 * object of paging & sort parameters
 * @param options An IHubSearchOptions object
 * @returns a partial ISearchChannels object
 */
export function processChannelOptions(options) {
    const channelOptions = {
        relations: [ChannelRelation.CHANNEL_ACL],
    };
    if (options.num) {
        channelOptions.num = options.num;
    }
    if (options.start) {
        channelOptions.start = options.start;
    }
    if (options.sortField && SORT_FIELD_MAP[options.sortField]) {
        channelOptions.sortBy = SORT_FIELD_MAP[options.sortField];
    }
    if (options.sortOrder && SORT_ORDER_MAP[options.sortOrder]) {
        channelOptions.sortOrder = SORT_ORDER_MAP[options.sortOrder];
    }
    return channelOptions;
}
//# sourceMappingURL=processChannelOptions.js.map