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 { DidCommOutboundMessageContext } from "../../../models/DidCommOutboundMessageContext.mjs";
import "../../../models/index.mjs";
import { DidCommTrustPingResponseMessage } from "../messages/DidCommTrustPingResponseMessage.mjs";
import "../messages/index.mjs";
import { DidCommTrustPingEventTypes } from "../DidCommTrustPingEvents.mjs";
import { EventEmitter, injectable } from "@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: DidCommTrustPingEventTypes.DidCommTrustPingReceivedEvent,
			payload: {
				connectionRecord: connection,
				message
			}
		});
		if (message.responseRequested) return new DidCommOutboundMessageContext(new DidCommTrustPingResponseMessage({ threadId: message.threadId }), {
			agentContext,
			connection
		});
	}
	processPingResponse(inboundMessage) {
		const { agentContext, message } = inboundMessage;
		const connection = inboundMessage.assertReadyConnection();
		this.eventEmitter.emit(agentContext, {
			type: DidCommTrustPingEventTypes.DidCommTrustPingResponseReceivedEvent,
			payload: {
				connectionRecord: connection,
				message
			}
		});
	}
};
DidCommTrustPingService = __decorate([injectable(), __decorateMetadata("design:paramtypes", [typeof (_ref = typeof EventEmitter !== "undefined" && EventEmitter) === "function" ? _ref : Object])], DidCommTrustPingService);

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