

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_Mdoc = require('../Mdoc.js');

//#region src/modules/mdoc/repository/MdocRecord.ts
var MdocRecord = class MdocRecord extends require_BaseRecord.BaseRecord {
	constructor(props) {
		super();
		this.type = MdocRecord.type;
		if (props) {
			this.id = props.id ?? require_uuid.uuid();
			this.createdAt = props.createdAt ?? /* @__PURE__ */ new Date();
			this.base64Url = props.mdoc.base64Url;
			this._tags = props.tags ?? {};
		}
	}
	getTags() {
		const mdoc = require_Mdoc.Mdoc.fromBase64Url(this.base64Url);
		const docType = mdoc.docType;
		const alg = mdoc.alg;
		return {
			...this._tags,
			docType,
			alg
		};
	}
	clone() {
		return require_JsonTransformer.JsonTransformer.fromJSON(require_JsonTransformer.JsonTransformer.toJSON(this), this.constructor);
	}
	/**
	* credential is convenience method added to all credential records
	*/
	get credential() {
		return require_Mdoc.Mdoc.fromBase64Url(this.base64Url);
	}
	/**
	* encoded is convenience method added to all credential records
	*/
	get encoded() {
		return this.base64Url;
	}
};
MdocRecord.type = "MdocRecord";

//#endregion
exports.MdocRecord = MdocRecord;