

import { ClassValidationError } from "../error/ClassValidationError.mjs";
import "../error/index.mjs";
import { isValidationErrorArray } from "../error/ValidationErrorUtils.mjs";
import { validateSync } from "class-validator";

//#region src/utils/MessageValidator.ts
var MessageValidator = class {
	/**
	*
	* @param classInstance the class instance to validate
	* @returns void
	* @throws array of validation errors {@link ValidationError}
	*/
	static validateSync(classInstance) {
		const errors = validateSync(classInstance);
		if (isValidationErrorArray(errors)) throw new ClassValidationError("Failed to validate class.", {
			classType: classInstance.constructor.name,
			validationErrors: errors
		});
		if (errors.length !== 0) throw new ClassValidationError("An unknown validation error occurred.", { classType: Object.prototype.constructor(classInstance).name });
	}
};

//#endregion
export { MessageValidator };
//# sourceMappingURL=MessageValidator.mjs.map