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 { IsValidMessageType, parseMessageType } from "../../../../../util/messageType.mjs";
import { DidCommMessage } from "../../../../../DidCommMessage.mjs";
import { DidCommCredentialFormatSpec } from "../../../models/DidCommCredentialFormatSpec.mjs";
import "../../../models/index.mjs";
import { DidCommCredentialV2Preview } from "./DidCommCredentialV2Preview.mjs";
import { Expose, Type } from "class-transformer";
import { IsArray, IsInstance, IsOptional, IsString, ValidateNested } from "class-validator";

//#region ../didcomm/src/modules/credentials/protocol/v2/messages/DidCommOfferCredentialV2Message.ts
var _ref;
var DidCommOfferCredentialV2Message = class DidCommOfferCredentialV2Message extends DidCommMessage {
	constructor(options) {
		super();
		this.type = DidCommOfferCredentialV2Message.type.messageTypeUri;
		if (options) {
			this.id = options.id ?? this.generateId();
			this.comment = options.comment;
			this.goalCode = options.goalCode;
			this.goal = options.goal;
			this.formats = options.formats;
			this.credentialPreview = options.credentialPreview;
			this.offerAttachments = options.offerAttachments;
		}
	}
	getOfferAttachmentById(id) {
		return this.offerAttachments.find((attachment) => attachment.id === id);
	}
};
DidCommOfferCredentialV2Message.type = parseMessageType("https://didcomm.org/issue-credential/2.0/offer-credential");
__decorate([
	Type(() => DidCommCredentialFormatSpec),
	ValidateNested(),
	IsArray(),
	IsInstance(DidCommCredentialFormatSpec, { each: true }),
	__decorateMetadata("design:type", Array)
], DidCommOfferCredentialV2Message.prototype, "formats", void 0);
__decorate([IsValidMessageType(DidCommOfferCredentialV2Message.type), __decorateMetadata("design:type", Object)], DidCommOfferCredentialV2Message.prototype, "type", void 0);
__decorate([
	IsString(),
	IsOptional(),
	__decorateMetadata("design:type", String)
], DidCommOfferCredentialV2Message.prototype, "comment", void 0);
__decorate([
	Expose({ name: "goal_code" }),
	IsString(),
	IsOptional(),
	__decorateMetadata("design:type", String)
], DidCommOfferCredentialV2Message.prototype, "goalCode", void 0);
__decorate([
	IsString(),
	IsOptional(),
	__decorateMetadata("design:type", String)
], DidCommOfferCredentialV2Message.prototype, "goal", void 0);
__decorate([
	IsOptional(),
	Expose({ name: "credential_preview" }),
	Type(() => DidCommCredentialV2Preview),
	ValidateNested(),
	IsInstance(DidCommCredentialV2Preview),
	__decorateMetadata("design:type", typeof (_ref = typeof DidCommCredentialV2Preview !== "undefined" && DidCommCredentialV2Preview) === "function" ? _ref : Object)
], DidCommOfferCredentialV2Message.prototype, "credentialPreview", void 0);
__decorate([
	Expose({ name: "offers~attach" }),
	Type(() => DidCommAttachment),
	IsArray(),
	ValidateNested({ each: true }),
	IsInstance(DidCommAttachment, { each: true }),
	__decorateMetadata("design:type", Array)
], DidCommOfferCredentialV2Message.prototype, "offerAttachments", void 0);
__decorate([
	Expose({ name: "replacement_id" }),
	IsString(),
	IsOptional(),
	__decorateMetadata("design:type", String)
], DidCommOfferCredentialV2Message.prototype, "replacementId", void 0);

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