const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.js');
const require_index = require('../../../../../../node_modules/.pnpm/class-transformer@0.5.1/node_modules/class-transformer/cjs/index.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_DidCommOutOfBandInvitation = require('../messages/DidCommOutOfBandInvitation.js');
require('../messages/index.js');
const require_thread = require('../../../util/thread.js');
let __credo_ts_core = require("@credo-ts/core");
__credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);

//#region ../didcomm/src/modules/oob/repository/DidCommOutOfBandRecord.ts
var import_cjs = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_index.require_cjs());
var _ref;
var DidCommOutOfBandRecord = class DidCommOutOfBandRecord extends __credo_ts_core.BaseRecord {
	constructor(props) {
		super();
		this.type = DidCommOutOfBandRecord.type;
		if (props) {
			this.id = props.id ?? __credo_ts_core.utils.uuid();
			this.createdAt = props.createdAt ?? /* @__PURE__ */ new Date();
			this.outOfBandInvitation = props.outOfBandInvitation;
			this.role = props.role;
			this.state = props.state;
			this.alias = props.alias;
			this.autoAcceptConnection = props.autoAcceptConnection;
			this.reusable = props.reusable ?? false;
			this.mediatorId = props.mediatorId;
			this.reuseConnectionId = props.reuseConnectionId;
			this.invitationInlineServiceKeys = props.invitationInlineServiceKeys;
			this._tags = props.tags ?? { recipientKeyFingerprints: [] };
		}
	}
	getTags() {
		return {
			...this._tags,
			role: this.role,
			state: this.state,
			invitationId: this.outOfBandInvitation.id,
			threadId: this.outOfBandInvitation.threadId,
			invitationRequestsThreadIds: this.outOfBandInvitation.getRequests()?.map((r) => require_thread.getThreadIdFromPlainTextMessage(r))
		};
	}
	assertRole(expectedRole) {
		if (this.role !== expectedRole) throw new __credo_ts_core.CredoError(`Invalid out-of-band record role ${this.role}, expected is ${expectedRole}.`);
	}
	assertState(expectedStates) {
		if (!Array.isArray(expectedStates)) expectedStates = [expectedStates];
		if (!expectedStates.includes(this.state)) throw new __credo_ts_core.CredoError(`Invalid out-of-band record state ${this.state}, valid states are: ${expectedStates.join(", ")}.`);
	}
};
DidCommOutOfBandRecord.type = "OutOfBandRecord";
require_decorate.__decorate([(0, import_cjs.Type)(() => require_DidCommOutOfBandInvitation.DidCommOutOfBandInvitation), require_decorateMetadata.__decorateMetadata("design:type", typeof (_ref = typeof require_DidCommOutOfBandInvitation.DidCommOutOfBandInvitation !== "undefined" && require_DidCommOutOfBandInvitation.DidCommOutOfBandInvitation) === "function" ? _ref : Object)], DidCommOutOfBandRecord.prototype, "outOfBandInvitation", void 0);

//#endregion
exports.DidCommOutOfBandRecord = DidCommOutOfBandRecord;