"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.titlePredicate = exports.timestampPredicate = exports.footerTextPredicate = exports.descriptionPredicate = exports.colorPredicate = exports.urlPredicate = exports.authorNamePredicate = exports.validateFieldLength = exports.embedFieldsArrayPredicate = exports.embedFieldPredicate = exports.fieldInlinePredicate = exports.fieldValuePredicate = exports.fieldNamePredicate = void 0;
const tslib_1 = require("tslib");
const ow_1 = tslib_1.__importDefault(require("ow"));
exports.fieldNamePredicate = ow_1.default.string.minLength(1).maxLength(256);
exports.fieldValuePredicate = ow_1.default.string.minLength(1).maxLength(1024);
exports.fieldInlinePredicate = ow_1.default.optional.boolean;
exports.embedFieldPredicate = ow_1.default.object.exactShape({
    name: exports.fieldNamePredicate,
    value: exports.fieldValuePredicate,
    inline: exports.fieldInlinePredicate,
});
exports.embedFieldsArrayPredicate = ow_1.default.array.ofType(exports.embedFieldPredicate);
function validateFieldLength(fields, amountAdding) {
    ow_1.default(fields.length + amountAdding, 'field amount', ow_1.default.number.lessThanOrEqual(25));
}
exports.validateFieldLength = validateFieldLength;
exports.authorNamePredicate = ow_1.default.any(exports.fieldNamePredicate, ow_1.default.null);
exports.urlPredicate = ow_1.default.any(ow_1.default.string.url, ow_1.default.nullOrUndefined);
exports.colorPredicate = ow_1.default.any(ow_1.default.number.greaterThanOrEqual(0).lessThanOrEqual(0xffffff), ow_1.default.null);
exports.descriptionPredicate = ow_1.default.any(ow_1.default.string.minLength(1).maxLength(4096), ow_1.default.null);
exports.footerTextPredicate = ow_1.default.any(ow_1.default.string.minLength(1).maxLength(2048), ow_1.default.null);
exports.timestampPredicate = ow_1.default.any(ow_1.default.number, ow_1.default.date, ow_1.default.null);
exports.titlePredicate = ow_1.default.any(exports.fieldNamePredicate, ow_1.default.null);
//# sourceMappingURL=Assertions.js.map