import { createSelector } from 'reselect';
var getPaginationState = function (state) { return state.pagination; };
var getFilterMap = createSelector([
    getPaginationState,
], function (state) { return state.filterMap; });
var getSkip = createSelector([
    getPaginationState,
], function (state) { return state.skip; });
var getSortBy = createSelector([
    getPaginationState,
], function (state) { return state.sortBy; });
var getSortOrder = createSelector([
    getPaginationState,
], function (state) { return state.sortOrder; });
var getTake = createSelector([
    getPaginationState,
], function (state) { return state.take; });
var getTotal = createSelector([
    getPaginationState,
], function (state) { return state.total; });
var getPageIndex = createSelector([
    getSkip,
    getTake,
], function (skip, take) { return take ?
    skip / take :
    skip; });
var getPage = createSelector([
    getPageIndex,
], function (pageIndex) { return pageIndex + 1; });
var hasMorePages = createSelector([
    getSkip,
    getTake,
    getTotal,
], function (skip, take, total) { return skip + take < total; });
var getSkipAndTakeKeyValuePairs = createSelector([
    getSkip,
    getTake,
], function (skip, take) { return [
    {
        key: 'skip',
        value: skip,
    },
    {
        key: 'take',
        value: take,
    },
]; });
var getSortKeyValuePairs = createSelector([
    getSortBy,
    getSortOrder,
], function (sortBy, sortOrder) { return sortOrder ?
    [
        {
            key: 'sortBy',
            value: sortBy,
        },
        {
            key: 'sortOrder',
            value: sortOrder,
        },
    ] :
    []; });
var getFilterKeyValuePairs = createSelector([
    getFilterMap,
], function (filterMap) { return Object.keys(filterMap).map(function (key) { return ({
    key: key,
    value: filterMap[key],
}); }); });
export default {
    getFilterMap: getFilterMap,
    getFilterKeyValuePairs: getFilterKeyValuePairs,
    getPage: getPage,
    getPageIndex: getPageIndex,
    getSkip: getSkip,
    getSkipAndTakeKeyValuePairs: getSkipAndTakeKeyValuePairs,
    getSortBy: getSortBy,
    getSortKeyValuePairs: getSortKeyValuePairs,
    getSortOrder: getSortOrder,
    getTake: getTake,
    getTotal: getTotal,
    hasMorePages: hasMorePages,
};
//# sourceMappingURL=PaginationSelectors.js.map