"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateOrThrow = validateOrThrow;
exports.assertInput = assertInput;
const http_1 = require("@deepkit/http");
/*@ts-ignore*/
var { __ΩReceiveType } = require('@deepkit/type');
const type_1 = require("@deepkit/type");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function validateOrThrow(data, type = validateOrThrow.Ω?.[0]) {
    validateOrThrow.Ω = undefined;
    const errors = (type_1.validate.Ω = [[type, 'n!']], (0, type_1.validate)(data, type));
    if (errors.length)
        throw new type_1.ValidationError(errors);
    return true;
}
validateOrThrow.__type = ['data', () => __ΩReceiveType, 'type', 'validateOrThrow', 'P"2!"o""2#8!/$'];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function assertInput(value, field) {
    if (value === undefined || value === null) {
        throw new http_1.HttpBadRequestError(field ? `${field} is required` : 'missing parameters');
    }
}
assertInput.__type = ['value', 'field', 'assertInput', 'P"2!&2"8!/#'];
//# sourceMappingURL=validation.js.map