

const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
const require_ClassValidationError = require('../error/ClassValidationError.js');
require('../error/index.js');
const require_ValidationErrorUtils = require('../error/ValidationErrorUtils.js');
let class_validator = require("class-validator");
class_validator = require_rolldown_runtime.__toESM(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 = (0, class_validator.validateSync)(classInstance);
		if (require_ValidationErrorUtils.isValidationErrorArray(errors)) throw new require_ClassValidationError.ClassValidationError("Failed to validate class.", {
			classType: classInstance.constructor.name,
			validationErrors: errors
		});
		if (errors.length !== 0) throw new require_ClassValidationError.ClassValidationError("An unknown validation error occurred.", { classType: Object.prototype.constructor(classInstance).name });
	}
};

//#endregion
exports.MessageValidator = MessageValidator;