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_index$1 = require('../../../../../node_modules/.pnpm/class-validator@0.14.1/node_modules/class-validator/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');
let __credo_ts_core = require("@credo-ts/core");
__credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);

//#region ../didcomm/src/models/features/DidCommFeature.ts
var import_cjs = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_index.require_cjs());
var import_cjs$1 = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_index$1.require_cjs());
var DidCommFeature = class DidCommFeature {
	constructor(props) {
		if (props) {
			this.id = props.id;
			this.type = props.type;
		}
	}
	/**
	* Combine this feature with another one, provided both are from the same type
	* and have the same id
	*
	* @param feature object to combine with this one
	* @returns a new object resulting from the combination between this and feature
	*/
	combine(feature) {
		if (feature.id !== this.id) throw new __credo_ts_core.CredoError("Can only combine with a feature with the same id");
		const obj1 = __credo_ts_core.JsonTransformer.toJSON(this);
		const obj2 = __credo_ts_core.JsonTransformer.toJSON(feature);
		for (const key in obj2) try {
			if (Array.isArray(obj2[key])) obj1[key] = [...new Set([...obj1[key], ...obj2[key]])];
			else obj1[key] = obj2[key];
		} catch (_e) {
			obj1[key] = obj2[key];
		}
		return __credo_ts_core.JsonTransformer.fromJSON(obj1, DidCommFeature);
	}
	toJSON() {
		return __credo_ts_core.JsonTransformer.toJSON(this);
	}
};
require_decorate.__decorate([
	(0, import_cjs$1.IsString)(),
	(0, import_cjs.Expose)({ name: "feature-type" }),
	require_decorateMetadata.__decorateMetadata("design:type", String)
], DidCommFeature.prototype, "type", void 0);

//#endregion
exports.DidCommFeature = DidCommFeature;