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 "./DidCommAttachment.mjs";
import { Expose, Type } from "class-transformer";
import { IsInstance, IsOptional, ValidateNested } from "class-validator";

//#region ../didcomm/src/decorators/attachment/AttachmentExtension.ts
function AttachmentDecorated(Base) {
	class AttachmentDecoratorExtension extends Base {
		getAppendedAttachmentById(id) {
			return this.appendedAttachments?.find((attachment) => attachment.id === id);
		}
		addAppendedAttachment(attachment) {
			if (this.appendedAttachments) this.appendedAttachments.push(attachment);
			else this.appendedAttachments = [attachment];
		}
	}
	__decorate([
		Expose({ name: "~attach" }),
		Type(() => DidCommAttachment),
		ValidateNested(),
		IsInstance(DidCommAttachment, { each: true }),
		IsOptional(),
		__decorateMetadata("design:type", Array)
	], AttachmentDecoratorExtension.prototype, "appendedAttachments", void 0);
	return AttachmentDecoratorExtension;
}

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