const require_DidCommOutboundMessageContext = require('../../../../../models/DidCommOutboundMessageContext.js');
require('../../../../../models/index.js');
const require_DidCommMessageDeliveryV2Message = require('../messages/DidCommMessageDeliveryV2Message.js');

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

//#endregion
exports.DidCommMessageDeliveryV2Handler = DidCommMessageDeliveryV2Handler;