const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.js');
const require_decorateMetadata = require('../../../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateMetadata.js');
const require_decorate = require('../../../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js');
const require_DidCommOutboundMessageContext = require('../../../models/DidCommOutboundMessageContext.js');
require('../../../models/index.js');
const require_DidCommTrustPingResponseMessage = require('../messages/DidCommTrustPingResponseMessage.js');
require('../messages/index.js');
const require_DidCommTrustPingEvents = require('../DidCommTrustPingEvents.js');
let __credo_ts_core = require("@credo-ts/core");
__credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);

//#region ../didcomm/src/modules/connections/services/DidCommTrustPingService.ts
var _ref;
let DidCommTrustPingService = class DidCommTrustPingService$1 {
	constructor(eventEmitter) {
		this.eventEmitter = eventEmitter;
	}
	processPing({ message, agentContext }, connection) {
		this.eventEmitter.emit(agentContext, {
			type: require_DidCommTrustPingEvents.DidCommTrustPingEventTypes.DidCommTrustPingReceivedEvent,
			payload: {
				connectionRecord: connection,
				message
			}
		});
		if (message.responseRequested) return new require_DidCommOutboundMessageContext.DidCommOutboundMessageContext(new require_DidCommTrustPingResponseMessage.DidCommTrustPingResponseMessage({ threadId: message.threadId }), {
			agentContext,
			connection
		});
	}
	processPingResponse(inboundMessage) {
		const { agentContext, message } = inboundMessage;
		const connection = inboundMessage.assertReadyConnection();
		this.eventEmitter.emit(agentContext, {
			type: require_DidCommTrustPingEvents.DidCommTrustPingEventTypes.DidCommTrustPingResponseReceivedEvent,
			payload: {
				connectionRecord: connection,
				message
			}
		});
	}
};
DidCommTrustPingService = require_decorate.__decorate([(0, __credo_ts_core.injectable)(), require_decorateMetadata.__decorateMetadata("design:paramtypes", [typeof (_ref = typeof __credo_ts_core.EventEmitter !== "undefined" && __credo_ts_core.EventEmitter) === "function" ? _ref : Object])], DidCommTrustPingService);

//#endregion
Object.defineProperty(exports, 'DidCommTrustPingService', {
  enumerable: true,
  get: function () {
    return DidCommTrustPingService;
  }
});