

import { JsonTransformer } from "../../../utils/JsonTransformer.mjs";
import "../../../utils/index.mjs";
import { BaseRecord } from "../../../storage/BaseRecord.mjs";
import { uuid } from "../../../utils/uuid.mjs";
import { Mdoc } from "../Mdoc.mjs";

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

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