const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
let __credo_ts_core = require("@credo-ts/core");
__credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);

//#region ../didcomm/src/models/DidCommOutboundMessageContext.ts
var DidCommOutboundMessageContext = class {
	constructor(message, context) {
		this.message = message;
		this.connection = context.connection;
		this.sessionId = context.sessionId;
		this.outOfBand = context.outOfBand;
		this.serviceParams = context.serviceParams;
		this.associatedRecord = context.associatedRecord;
		this.inboundMessageContext = context.inboundMessageContext;
		this.agentContext = context.agentContext;
	}
	/**
	* Assert the outbound message has a ready connection associated with it.
	*
	* @throws {CredoError} if there is no connection or the connection is not ready
	*/
	assertReadyConnection() {
		if (!this.connection) throw new __credo_ts_core.CredoError(`No connection associated with outgoing message ${this.message.type}`);
		this.connection.assertReady();
		return this.connection;
	}
	isOutboundServiceMessage() {
		return this.serviceParams?.service !== void 0;
	}
	toJSON() {
		return {
			message: this.message,
			outOfBand: this.outOfBand,
			associatedRecord: this.associatedRecord,
			sessionId: this.sessionId,
			serviceParams: this.serviceParams,
			agentContext: this.agentContext.toJSON(),
			connection: this.connection
		};
	}
};

//#endregion
exports.DidCommOutboundMessageContext = DidCommOutboundMessageContext;