

const require_decorateMetadata = require('../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateMetadata.js');
const require_decorate = require('../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js');
const require_JsonTransformer = require('../../../utils/JsonTransformer.js');
require('../../../utils/index.js');
const require_BaseRecord = require('../../../storage/BaseRecord.js');
const require_uuid = require('../../../utils/uuid.js');
const require_ClaimFormat = require('../models/ClaimFormat.js');
const require_W3cVerifiableCredential = require('../models/credential/W3cVerifiableCredential.js');
require('../models/index.js');

//#region src/modules/vc/repository/W3cCredentialRecord.ts
var W3cCredentialRecord = class W3cCredentialRecord extends require_BaseRecord.BaseRecord {
	constructor(props) {
		super();
		this.type = W3cCredentialRecord.type;
		if (props) {
			this.id = props.id ?? require_uuid.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 === require_ClaimFormat.ClaimFormat.LdpVc) {
			tags.proofTypes = this.credential.proofTypes;
			tags.cryptosuites = this.credential.dataIntegrityCryptosuites;
		} else if (this.credential.claimFormat === require_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 require_JsonTransformer.JsonTransformer.fromJSON(require_JsonTransformer.JsonTransformer.toJSON(this), this.constructor);
	}
	/**
	* encoded is convenience method added to all credential records
	*/
	get encoded() {
		return this.credential.encoded;
	}
};
W3cCredentialRecord.type = "W3cCredentialRecord";
require_decorate.__decorate([require_W3cVerifiableCredential.W3cVerifiableCredentialTransformer(), require_decorateMetadata.__decorateMetadata("design:type", Object)], W3cCredentialRecord.prototype, "credential", void 0);

//#endregion
exports.W3cCredentialRecord = W3cCredentialRecord;