

const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
const require_CredoError = require('../../../../error/CredoError.js');
require('../../../../error/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_validators = require('../../../../utils/validators.js');
require('../../../../utils/index.js');
const require_DidDocumentService = require('./DidDocumentService.js');
let class_transformer = require("class-transformer");
class_transformer = require_rolldown_runtime.__toESM(class_transformer);
let class_validator = require("class-validator");
class_validator = require_rolldown_runtime.__toESM(class_validator);

//#region src/modules/dids/domain/service/DidCommV2Service.ts
var DidCommV2ServiceEndpoint = class {
	constructor(options) {
		if (options) {
			this.uri = options.uri;
			this.routingKeys = options.routingKeys;
			this.accept = options.accept;
		}
	}
};
require_decorate.__decorate([
	(0, class_validator.IsString)(),
	require_validators.IsUri(),
	require_decorateMetadata.__decorateMetadata("design:type", String)
], DidCommV2ServiceEndpoint.prototype, "uri", void 0);
require_decorate.__decorate([
	(0, class_validator.IsString)({ each: true }),
	(0, class_validator.IsOptional)(),
	require_decorateMetadata.__decorateMetadata("design:type", Array)
], DidCommV2ServiceEndpoint.prototype, "routingKeys", void 0);
require_decorate.__decorate([
	(0, class_validator.IsString)({ each: true }),
	(0, class_validator.IsOptional)(),
	require_decorateMetadata.__decorateMetadata("design:type", Array)
], DidCommV2ServiceEndpoint.prototype, "accept", void 0);
var DidCommV2Service = class DidCommV2Service extends require_DidDocumentService.DidDocumentService {
	constructor(options) {
		super({
			...options,
			type: DidCommV2Service.type
		});
		if (options) this.serviceEndpoint = options.serviceEndpoint;
	}
	get firstServiceEndpointUri() {
		if (Array.isArray(this.serviceEndpoint)) {
			if (this.serviceEndpoint.length === 0) throw new require_CredoError.CredoError("No entries in serviceEndpoint array");
			return this.serviceEndpoint[0].uri;
		}
		return this.serviceEndpoint.uri;
	}
};
DidCommV2Service.type = "DIDCommMessaging";
require_decorate.__decorate([
	require_validators.IsInstanceOrArrayOfInstances({ classType: [DidCommV2ServiceEndpoint] }),
	(0, class_validator.ValidateNested)(),
	(0, class_transformer.Type)(() => DidCommV2ServiceEndpoint),
	require_decorateMetadata.__decorateMetadata("design:type", Object)
], DidCommV2Service.prototype, "serviceEndpoint", void 0);

//#endregion
exports.DidCommV2Service = DidCommV2Service;
exports.DidCommV2ServiceEndpoint = DidCommV2ServiceEndpoint;