"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RoomSort = void 0;
var RoomSort;
(function (RoomSort) {
    RoomSort["PriceLow"] = "Lowest Price";
    RoomSort["PriceHigh"] = "Highest Price";
    RoomSort["Recommended"] = "Recommended";
})(RoomSort || (exports.RoomSort = RoomSort = {}));
class RoomSortProvider {
}
// TODO refactor this to use static val instead of request one
RoomSortProvider.getSortByFunction = (sortBy) => {
    switch (sortBy) {
        case RoomSort.PriceHigh:
            return (a, b) => {
                const priceDiff = b.getPriceSortValue() - a.getPriceSortValue();
                if (priceDiff === 0 && a.getOrderSortValue && b.getOrderSortValue) {
                    return (b.getOrderSortValue() || 0) - (a.getOrderSortValue() || 0);
                }
                return priceDiff;
            };
        case RoomSort.PriceLow:
            return (a, b) => {
                const priceDiff = a.getPriceSortValue() - b.getPriceSortValue();
                if (priceDiff === 0 && a.getOrderSortValue && b.getOrderSortValue) {
                    return (b.getOrderSortValue() || 0) - (a.getOrderSortValue() || 0);
                }
                return priceDiff;
            };
        case RoomSort.Recommended:
            return (a, b) => {
                const orderDiff = b.getRecommendedSortValue() - a.getRecommendedSortValue();
                if (orderDiff === 0 && a.getOrderSortValue && b.getOrderSortValue) {
                    return (b.getOrderSortValue() || 0) - (a.getOrderSortValue() || 0);
                }
                return orderDiff;
            };
        default:
            return () => 0;
    }
};
exports.default = RoomSortProvider;
//# sourceMappingURL=RoomSortProvider.js.map