

import { __decorateMetadata } from "../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateMetadata.mjs";
import { __decorate } from "../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.mjs";
import { mapSingleOrArray } from "../../../../utils/array.mjs";
import { JsonTransformer } from "../../../../utils/JsonTransformer.mjs";
import { IsInstanceOrArrayOfInstances, IsNever, IsUri } from "../../../../utils/validators.mjs";
import "../../../../utils/index.mjs";
import { CREDENTIALS_CONTEXT_V2_URL, VERIFIABLE_PRESENTATION_TYPE } from "../../constants.mjs";
import { IsCredentialJsonLdContext, IsVerifiablePresentationType } from "../../validators.mjs";
import { W3cV2EnvelopedVerifiableCredential, W3cV2EnvelopedVerifiableCredentialTransformer } from "../credential/W3cV2EnvelopedVerifiableCredential.mjs";
import { IsW3cV2Holder, W3cV2Holder, W3cV2HolderTransformer } from "./W3cV2Holder.mjs";
import { Expose } from "class-transformer";
import { IsOptional, ValidateNested } from "class-validator";

//#region src/modules/vc/models/presentation/W3cV2Presentation.ts
var _ref;
var W3cV2Presentation = class {
	constructor(options) {
		if (options) {
			this.id = options.id;
			this.context = options.context ?? [CREDENTIALS_CONTEXT_V2_URL];
			this.type = options.type ?? [VERIFIABLE_PRESENTATION_TYPE];
			this.verifiableCredential = mapSingleOrArray(options.verifiableCredential, (options$1) => new W3cV2EnvelopedVerifiableCredential(options$1));
			if (options.holder) this.holder = typeof options.holder === "string" ? options.holder : new W3cV2Holder(options.holder);
		}
	}
	get holderId() {
		if (!this.holder) return void 0;
		return this.holder instanceof W3cV2Holder ? this.holder.id : this.holder;
	}
	toJSON() {
		return JsonTransformer.toJSON(this);
	}
};
__decorate([
	Expose({ name: "@context" }),
	IsCredentialJsonLdContext({ credentialContext: CREDENTIALS_CONTEXT_V2_URL }),
	__decorateMetadata("design:type", typeof (_ref = typeof Array !== "undefined" && Array) === "function" ? _ref : Object)
], W3cV2Presentation.prototype, "context", void 0);
__decorate([
	IsOptional(),
	IsUri(),
	__decorateMetadata("design:type", String)
], W3cV2Presentation.prototype, "id", void 0);
__decorate([IsVerifiablePresentationType(), __decorateMetadata("design:type", Object)], W3cV2Presentation.prototype, "type", void 0);
__decorate([
	W3cV2HolderTransformer(),
	IsW3cV2Holder(),
	IsOptional(),
	__decorateMetadata("design:type", Object)
], W3cV2Presentation.prototype, "holder", void 0);
__decorate([
	W3cV2EnvelopedVerifiableCredentialTransformer(),
	IsInstanceOrArrayOfInstances({ classType: W3cV2EnvelopedVerifiableCredential }),
	ValidateNested({ each: true }),
	__decorateMetadata("design:type", Object)
], W3cV2Presentation.prototype, "verifiableCredential", void 0);
__decorate([IsNever(), __decorateMetadata("design:type", void 0)], W3cV2Presentation.prototype, "vc", void 0);
__decorate([IsNever(), __decorateMetadata("design:type", void 0)], W3cV2Presentation.prototype, "vp", void 0);

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