

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 { asArray, mapSingleOrArray } from "../../../../utils/array.mjs";
import { JsonTransformer } from "../../../../utils/JsonTransformer.mjs";
import { IsInstanceOrArrayOfInstances } from "../../../../utils/validators.mjs";
import "../../../../utils/index.mjs";
import { ClaimFormat } from "../../models/ClaimFormat.mjs";
import { W3cCredential } from "../../models/credential/W3cCredential.mjs";
import { DataIntegrityProof } from "./DataIntegrityProof.mjs";
import { LinkedDataProof } from "./LinkedDataProof.mjs";
import { ProofTransformer } from "./ProofTransformer.mjs";
import { ValidateNested } from "class-validator";

//#region src/modules/vc/data-integrity/models/W3cJsonLdVerifiableCredential.ts
var W3cJsonLdVerifiableCredential = class W3cJsonLdVerifiableCredential extends W3cCredential {
	constructor(options) {
		super(options);
		if (options) this.proof = mapSingleOrArray(options.proof, (proof) => {
			if (proof.cryptosuite) return new DataIntegrityProof(proof);
			return new LinkedDataProof(proof);
		});
	}
	get proofTypes() {
		return (asArray(this.proof) ?? []).map((proof) => proof.type);
	}
	get dataIntegrityCryptosuites() {
		return (asArray(this.proof) ?? []).filter((proof) => proof.type === "DataIntegrityProof" && "cryptosuite" in proof).map((proof) => proof.cryptosuite);
	}
	toJson() {
		return JsonTransformer.toJSON(this);
	}
	static fromJson(json) {
		return JsonTransformer.fromJSON(json, W3cJsonLdVerifiableCredential);
	}
	/**
	* The {@link ClaimFormat} of the credential. For JSON-LD credentials this is always `ldp_vc`.
	*/
	get claimFormat() {
		return ClaimFormat.LdpVc;
	}
	/**
	* Get the encoded variant of the W3C Verifiable Credential. For JSON-LD credentials this is
	* a JSON object.
	*/
	get encoded() {
		return this.toJson();
	}
	get jsonCredential() {
		return this.toJson();
	}
};
__decorate([
	ProofTransformer(),
	IsInstanceOrArrayOfInstances({ classType: [LinkedDataProof, DataIntegrityProof] }),
	ValidateNested(),
	__decorateMetadata("design:type", Object)
], W3cJsonLdVerifiableCredential.prototype, "proof", void 0);

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