"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pageNumber = exports.sortState = exports.sortDirection = void 0;
var PropTypes = require("prop-types");
var sortDirection_1 = require("./sortDirection");
exports.sortDirection = PropTypes.oneOf([
    sortDirection_1.default.ASCENDING,
    sortDirection_1.default.DESCENDING,
]);
exports.sortState = PropTypes.shape({
    columnID: PropTypes.string,
    direction: exports.sortDirection,
});
exports.pageNumber = function (props, propName, componentName) {
    var value = props[propName];
    if (value === null || value === undefined) {
        return null;
    }
    if (typeof value !== "number" || value < 1) {
        return new Error("Invalid prop `" + propName + "` supplied to " + componentName + ". Must be a 1-based page index.");
    }
    return null;
};
exports.pageNumber.isRequired = function (props, propName, componentName) {
    var value = props[propName];
    if (value === null || value === undefined) {
        return new Error("Missing required prop `" + propName + "` in " + componentName + ".");
    }
    return exports.pageNumber(props, propName, componentName);
};
