

const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
const require_DataIntegrityProof = require('./DataIntegrityProof.js');
const require_LinkedDataProof = require('./LinkedDataProof.js');
let class_transformer = require("class-transformer");

//#region src/modules/vc/data-integrity/models/ProofTransformer.ts
function ProofTransformer() {
	return (0, class_transformer.Transform)(({ value, type }) => {
		if (type === class_transformer.TransformationType.PLAIN_TO_CLASS) {
			const plainOptionsToClass = (v) => {
				if ("cryptosuite" in v) return (0, class_transformer.plainToInstance)(require_DataIntegrityProof.DataIntegrityProof, v);
				return (0, class_transformer.plainToInstance)(require_LinkedDataProof.LinkedDataProof, v);
			};
			if (Array.isArray(value)) return value.map(plainOptionsToClass);
			return plainOptionsToClass(value);
		}
		if (type === class_transformer.TransformationType.CLASS_TO_PLAIN) {
			if (Array.isArray(value)) return value.map((v) => (0, class_transformer.instanceToPlain)(v));
			return (0, class_transformer.instanceToPlain)(value);
		}
		return value;
	});
}

//#endregion
exports.ProofTransformer = ProofTransformer;