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 { DidCommModuleConfig } from "./DidCommModuleConfig.mjs";
import { DidCommMessageSender } from "./DidCommMessageSender.mjs";
import { DidCommConnectionsApi } from "./modules/connections/DidCommConnectionsApi.mjs";
import { DidCommFeatureRegistry } from "./DidCommFeatureRegistry.mjs";
import { DidCommMessageHandlerRegistry } from "./DidCommMessageHandlerRegistry.mjs";
import { DidCommBasicMessagesApi } from "./modules/basic-messages/DidCommBasicMessagesApi.mjs";
import { DidCommOutOfBandApi } from "./modules/oob/DidCommOutOfBandApi.mjs";
import { DidCommMessagePickupApi } from "./modules/message-pickup/DidCommMessagePickupApi.mjs";
import { DidCommMediatorApi } from "./modules/routing/DidCommMediatorApi.mjs";
import { DidCommDiscoverFeaturesApi } from "./modules/discover-features/DidCommDiscoverFeaturesApi.mjs";
import { DidCommMediationRecipientApi } from "./modules/routing/DidCommMediationRecipientApi.mjs";
import { DidCommCredentialsApi } from "./modules/credentials/DidCommCredentialsApi.mjs";
import { DidCommProofsApi } from "./modules/proofs/DidCommProofsApi.mjs";
import "./modules/index.mjs";
import { DidCommMessageReceiver } from "./DidCommMessageReceiver.mjs";
import { AgentContext, injectable } from "@credo-ts/core";

//#region ../didcomm/src/DidCommApi.ts
var _ref, _ref2, _ref3, _ref4, _ref5, _ref6;
let DidCommApi = class DidCommApi$1 {
	constructor(agentContext, messageHandlerRegistry, messageSender, messageReceiver, featureRegistry, config) {
		this.agentContext = agentContext;
		this.messageHandlerRegistry = messageHandlerRegistry;
		this.messageSender = messageSender;
		this.messageReceiver = messageReceiver;
		this.featureRegistry = featureRegistry;
		this.config = config;
		this.connections = this.agentContext.resolve(DidCommConnectionsApi);
		this.oob = this.agentContext.resolve(DidCommOutOfBandApi);
		this.discovery = this.agentContext.resolve(DidCommDiscoverFeaturesApi);
		this.proofs = this.apiOrUndefined(this.config.enabledModules.proofs, DidCommProofsApi);
		this.credentials = this.apiOrUndefined(this.config.enabledModules.credentials, DidCommCredentialsApi);
		this.messagePickup = this.apiOrUndefined(this.config.enabledModules.messagePickup, DidCommMessagePickupApi);
		this.basicMessages = this.apiOrUndefined(this.config.enabledModules.basicMessages, DidCommBasicMessagesApi);
		this.mediator = this.apiOrUndefined(this.config.enabledModules.mediator, DidCommMediatorApi);
		this.mediationRecipient = this.apiOrUndefined(this.config.enabledModules.mediationRecipient, DidCommMediationRecipientApi);
	}
	registerInboundTransport(inboundTransport) {
		this.messageReceiver.registerInboundTransport(inboundTransport);
	}
	async unregisterInboundTransport(inboundTransport) {
		await this.messageReceiver.unregisterInboundTransport(inboundTransport);
	}
	get inboundTransports() {
		return this.messageReceiver.inboundTransports;
	}
	registerOutboundTransport(outboundTransport) {
		this.messageSender.registerOutboundTransport(outboundTransport);
	}
	async unregisterOutboundTransport(outboundTransport) {
		await this.messageSender.unregisterOutboundTransport(outboundTransport);
	}
	get outboundTransports() {
		return this.messageSender.outboundTransports;
	}
	/**
	* Agent's feature registry
	*/
	registerMessageHandlers(messageHandlers) {
		for (const messageHandler of messageHandlers) this.messageHandlerRegistry.registerMessageHandler(messageHandler);
	}
	registerMessageHandlerMiddleware(messageHandlerMiddleware) {
		this.messageHandlerRegistry.registerMessageHandlerMiddleware(messageHandlerMiddleware);
	}
	get fallbackMessageHandler() {
		return this.messageHandlerRegistry.fallbackMessageHandler;
	}
	get messageHandlerMiddlewares() {
		return this.messageHandlerRegistry.messageHandlerMiddlewares;
	}
	/**
	* Sets the fallback message handler, the message handler that will be called if no handler
	* is registered for an incoming message type.
	*/
	setFallbackMessageHandler(fallbackMessageHandler) {
		this.messageHandlerRegistry.setFallbackMessageHandler(fallbackMessageHandler);
	}
	get features() {
		return this.featureRegistry;
	}
	apiOrUndefined(isEnabled, apiClass) {
		if (isEnabled) return this.agentContext.resolve(apiClass);
	}
};
DidCommApi = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
	typeof (_ref = typeof AgentContext !== "undefined" && AgentContext) === "function" ? _ref : Object,
	typeof (_ref2 = typeof DidCommMessageHandlerRegistry !== "undefined" && DidCommMessageHandlerRegistry) === "function" ? _ref2 : Object,
	typeof (_ref3 = typeof DidCommMessageSender !== "undefined" && DidCommMessageSender) === "function" ? _ref3 : Object,
	typeof (_ref4 = typeof DidCommMessageReceiver !== "undefined" && DidCommMessageReceiver) === "function" ? _ref4 : Object,
	typeof (_ref5 = typeof DidCommFeatureRegistry !== "undefined" && DidCommFeatureRegistry) === "function" ? _ref5 : Object,
	typeof (_ref6 = typeof DidCommModuleConfig !== "undefined" && DidCommModuleConfig) === "function" ? _ref6 : Object
])], DidCommApi);

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