

const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
const require_decorateMetadata = require('../../../_virtual/_@oxc-project_runtime@0.97.0/helpers/decorateMetadata.js');
const require_decorate = require('../../../_virtual/_@oxc-project_runtime@0.97.0/helpers/decorate.js');
const require_BaseRecord = require('../../../storage/BaseRecord.js');
const require_parse = require('../domain/parse.js');
const require_DidDocument = require('../domain/DidDocument.js');
const require_DidDocumentRole = require('../domain/DidDocumentRole.js');
require('../domain/index.js');
const require_uuid = require('../../../utils/uuid.js');
const require_didRecordMetadataTypes = require('./didRecordMetadataTypes.js');
let class_transformer = require("class-transformer");
let class_validator = require("class-validator");

//#region src/modules/dids/repository/DidRecord.ts
var _ref, _ref2;
var DidRecord = class DidRecord extends require_BaseRecord.BaseRecord {
	constructor(props) {
		super();
		this.type = DidRecord.type;
		if (props) {
			this.id = props.id ?? require_uuid.uuid();
			this.did = props.did;
			this.role = props.role;
			this.didDocument = props.didDocument;
			this.createdAt = props.createdAt ?? /* @__PURE__ */ new Date();
			this._tags = props.tags ?? {};
			this.keys = props.keys;
		}
	}
	getTags() {
		const did = require_parse.parseDid(this.did);
		const legacyDid = this.metadata.get(require_didRecordMetadataTypes.DidRecordMetadataKeys.LegacyDid);
		return {
			...this._tags,
			role: this.role,
			method: did.method,
			legacyUnqualifiedDid: legacyDid?.unqualifiedDid,
			did: this.did,
			methodSpecificIdentifier: did.id,
			recipientKeyFingerprints: this.didDocument ? this.didDocument.recipientKeys.map((recipientKey) => recipientKey.fingerprint) : this._tags.recipientKeyFingerprints
		};
	}
};
DidRecord.type = "DidRecord";
require_decorate.__decorate([
	(0, class_transformer.Type)(() => require_DidDocument.DidDocument),
	(0, class_validator.ValidateNested)(),
	require_decorateMetadata.__decorateMetadata("design:type", typeof (_ref = typeof require_DidDocument.DidDocument !== "undefined" && require_DidDocument.DidDocument) === "function" ? _ref : Object)
], DidRecord.prototype, "didDocument", void 0);
require_decorate.__decorate([(0, class_validator.IsEnum)(require_DidDocumentRole.DidDocumentRole), require_decorateMetadata.__decorateMetadata("design:type", typeof (_ref2 = typeof require_DidDocumentRole.DidDocumentRole !== "undefined" && require_DidDocumentRole.DidDocumentRole) === "function" ? _ref2 : Object)], DidRecord.prototype, "role", void 0);

//#endregion
exports.DidRecord = DidRecord;