import { __decorateMetadata } from "../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateMetadata.mjs";
import { __decorate } from "../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.mjs";
import { DidCommAttachment } from "../decorators/attachment/DidCommAttachment.mjs";
import { encodeAttachment } from "./attachment.mjs";
import { Type } from "class-transformer";
import { IsString } from "class-validator";

//#region ../didcomm/src/util/DidCommLinkedAttachment.ts
var _ref;
var DidCommLinkedAttachment = class {
	constructor(options) {
		this.attributeName = options.name;
		this.attachment = options.attachment;
		this.attachment.id = this.getId(options.attachment);
	}
	/**
	* Generates an ID based on the data in the attachment
	*
	* @param attachment the attachment that requires a hashlink
	* @returns the id
	*/
	getId(attachment) {
		return encodeAttachment(attachment).split(":")[1].substring(0, 64);
	}
};
__decorate([IsString(), __decorateMetadata("design:type", String)], DidCommLinkedAttachment.prototype, "attributeName", void 0);
__decorate([Type(() => DidCommAttachment), __decorateMetadata("design:type", typeof (_ref = typeof DidCommAttachment !== "undefined" && DidCommAttachment) === "function" ? _ref : Object)], DidCommLinkedAttachment.prototype, "attachment", void 0);

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