

const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
const require_decorateMetadata = require('../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateMetadata.js');
const require_decorate = require('../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js');
const require_validators = require('../../../../utils/validators.js');
require('../../../../utils/index.js');
let class_transformer = require("class-transformer");
class_transformer = require_rolldown_runtime.__toESM(class_transformer);
let class_validator = require("class-validator");
class_validator = require_rolldown_runtime.__toESM(class_validator);

//#region src/modules/vc/models/presentation/W3cV2Holder.ts
/**
* Represents a credential holder.
*
* @see https://www.w3.org/TR/vc-data-model-2.0/#holder
*/
var W3cV2Holder = class {
	constructor(options) {
		if (options) {
			const { id,...rest } = options;
			(0, class_transformer.plainToClassFromExist)(this, rest);
			this.id = id;
		}
	}
};
require_decorate.__decorate([require_validators.IsUri(), require_decorateMetadata.__decorateMetadata("design:type", String)], W3cV2Holder.prototype, "id", void 0);
function W3cV2HolderTransformer() {
	return (0, class_transformer.Transform)(({ value, type }) => {
		if (type === class_transformer.TransformationType.PLAIN_TO_CLASS) {
			if ((0, class_validator.isString)(value)) return value;
			return (0, class_transformer.plainToInstance)(W3cV2Holder, value);
		}
		if (type === class_transformer.TransformationType.CLASS_TO_PLAIN) {
			if ((0, class_validator.isString)(value)) return value;
			return (0, class_transformer.instanceToPlain)(value);
		}
		return value;
	});
}
function IsW3cV2Holder(validationOptions) {
	return (0, class_validator.ValidateBy)({
		name: "IsW3cV2Holder",
		validator: {
			validate: (value) => {
				return typeof value === "string" && require_validators.isUri(value) || (0, class_validator.isInstance)(value, W3cV2Holder) && require_validators.isUri(value.id);
			},
			defaultMessage: (0, class_validator.buildMessage)((eachPrefix) => `${eachPrefix}$property must be an URL or a valid W3cV2Holder instance`, validationOptions)
		}
	}, validationOptions);
}

//#endregion
exports.IsW3cV2Holder = IsW3cV2Holder;
exports.W3cV2Holder = W3cV2Holder;
exports.W3cV2HolderTransformer = W3cV2HolderTransformer;