import { DidCommOutboundMessageContext } from "../../../../../models/DidCommOutboundMessageContext.mjs";
import "../../../../../models/index.mjs";
import { DidCommMessageDeliveryV2Message } from "../messages/DidCommMessageDeliveryV2Message.mjs";

//#region ../didcomm/src/modules/message-pickup/protocol/v2/handlers/DidCommMessageDeliveryV2Handler.ts
var DidCommMessageDeliveryV2Handler = class {
	constructor(messagePickupService) {
		this.supportedMessages = [DidCommMessageDeliveryV2Message];
		this.messagePickupService = messagePickupService;
	}
	async handle(messageContext) {
		const connection = messageContext.assertReadyConnection();
		const deliveryReceivedMessage = await this.messagePickupService.processDelivery(messageContext);
		if (deliveryReceivedMessage) return new DidCommOutboundMessageContext(deliveryReceivedMessage, {
			agentContext: messageContext.agentContext,
			connection
		});
	}
};

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