

import { __decorateMetadata } from "../../../_virtual/_@oxc-project_runtime@0.95.0/helpers/decorateMetadata.mjs";
import { __decorate } from "../../../_virtual/_@oxc-project_runtime@0.95.0/helpers/decorate.mjs";
import { JsonTransformer } from "../../../utils/JsonTransformer.mjs";
import "../../../utils/index.mjs";
import { BaseRecord } from "../../../storage/BaseRecord.mjs";
import { uuid } from "../../../utils/uuid.mjs";
import { ClaimFormat } from "../models/ClaimFormat.mjs";
import { W3cVerifiableCredentialTransformer } from "../models/credential/W3cVerifiableCredential.mjs";
import "../models/index.mjs";

//#region src/modules/vc/repository/W3cCredentialRecord.ts
var W3cCredentialRecord = class W3cCredentialRecord extends BaseRecord {
	constructor(props) {
		super();
		this.type = W3cCredentialRecord.type;
		if (props) {
			this.id = props.id ?? uuid();
			this.createdAt = props.createdAt ?? /* @__PURE__ */ new Date();
			this._tags = props.tags;
			this.credential = props.credential;
		}
	}
	getTags() {
		const stringContexts = this.credential.contexts.filter((ctx) => typeof ctx === "string");
		const tags = {
			...this._tags,
			issuerId: this.credential.issuerId,
			subjectIds: this.credential.credentialSubjectIds,
			schemaIds: this.credential.credentialSchemaIds,
			contexts: stringContexts,
			givenId: this.credential.id,
			claimFormat: this.credential.claimFormat,
			types: this.credential.type
		};
		if (this.credential.claimFormat === ClaimFormat.LdpVc) {
			tags.proofTypes = this.credential.proofTypes;
			tags.cryptosuites = this.credential.dataIntegrityCryptosuites;
		} else if (this.credential.claimFormat === ClaimFormat.JwtVc) tags.algs = [this.credential.jwt.header.alg];
		return tags;
	}
	/**
	* This overwrites the default clone method for records
	* as the W3cRecord has issues with the default clone method
	* due to how W3cJwtVerifiableCredential is implemented. This is
	* a temporary way to make sure the clone still works, but ideally
	* we find an alternative.
	*/
	clone() {
		return JsonTransformer.fromJSON(JsonTransformer.toJSON(this), this.constructor);
	}
	/**
	* encoded is convenience method added to all credential records
	*/
	get encoded() {
		return this.credential.encoded;
	}
};
W3cCredentialRecord.type = "W3cCredentialRecord";
__decorate([W3cVerifiableCredentialTransformer(), __decorateMetadata("design:type", Object)], W3cCredentialRecord.prototype, "credential", void 0);

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