"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryResultPagingManager = void 0;
const defaults_1 = require("../../constants/defaults");
class QueryResultPagingManager {
    static canMovePrevious(queryResult) {
        return !!queryResult && queryResult.offset > 0;
    }
    static canMoveNext(queryResult) {
        return (!queryResult || QueryResultPagingManager.getOffsetNextPage(queryResult) < queryResult.totalNumberOfResults);
    }
    static getOffsetPreviousPage(queryResult) {
        return Math.max(queryResult != null ? queryResult.offset - queryResult.items.length : 0, 0);
    }
    static getOffsetNextPage(queryResult) {
        return Math.max(queryResult != null ? queryResult.offset + queryResult.items.length : 0, 0);
    }
    static getIterationPageSize(queryResult) {
        return !queryResult || queryResult.items.length === 0 ? defaults_1.ITERATING.pageSize : queryResult.items.length;
    }
}
exports.QueryResultPagingManager = QueryResultPagingManager;
//# sourceMappingURL=query-result-paging-manager.js.map