

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

//#region src/modules/vc/models/credential/W3cV2LocalizedValue.ts
/**
* Represents a localized string.
*
* @see https://www.w3.org/TR/vc-data-model-2.0/#internationalization-considerations
*/
var W3cV2LocalizedValue = class {
	constructor(options) {
		if (options) {
			const { value, language, direction, ...rest } = options;
			(0, class_transformer.plainToClassFromExist)(this, rest);
			this.value = value;
			this.language = language;
			this.direction = direction;
		}
	}
};
require_decorate.__decorate([
	(0, class_transformer.Expose)({ name: "@value" }),
	(0, class_validator.IsString)(),
	require_decorateMetadata.__decorateMetadata("design:type", String)
], W3cV2LocalizedValue.prototype, "value", void 0);
require_decorate.__decorate([
	(0, class_transformer.Expose)({ name: "@language" }),
	(0, class_validator.IsOptional)(),
	(0, class_validator.IsString)(),
	require_decorateMetadata.__decorateMetadata("design:type", Object)
], W3cV2LocalizedValue.prototype, "language", void 0);
require_decorate.__decorate([
	(0, class_transformer.Expose)({ name: "@direction" }),
	(0, class_validator.IsOptional)(),
	(0, class_validator.IsEnum)([
		"ltr",
		"rtl",
		null
	]),
	require_decorateMetadata.__decorateMetadata("design:type", Object)
], W3cV2LocalizedValue.prototype, "direction", void 0);
function W3cV2LocalizedValueTransformer() {
	return (0, class_transformer.Transform)(({ value, type }) => {
		if (type === class_transformer.TransformationType.PLAIN_TO_CLASS) {
			if ((0, class_validator.isString)(value)) return value;
			if (Array.isArray(value)) return value.map((v) => (0, class_transformer.plainToInstance)(W3cV2LocalizedValue, v));
			return (0, class_transformer.plainToInstance)(W3cV2LocalizedValue, value);
		}
		if (type === class_transformer.TransformationType.CLASS_TO_PLAIN) {
			if ((0, class_validator.isString)(value)) return value;
			if (Array.isArray(value)) return value.map((v) => (0, class_transformer.instanceToPlain)(W3cV2LocalizedValue, v));
			return (0, class_transformer.instanceToPlain)(value);
		}
		return value;
	});
}

//#endregion
exports.W3cV2LocalizedValue = W3cV2LocalizedValue;
exports.W3cV2LocalizedValueTransformer = W3cV2LocalizedValueTransformer;