

import { CredoError } from "../../../../error/CredoError.mjs";
import "../../../../error/index.mjs";
import { __decorateMetadata } from "../../../../_virtual/_@oxc-project_runtime@0.97.0/helpers/decorateMetadata.mjs";
import { __decorate } from "../../../../_virtual/_@oxc-project_runtime@0.97.0/helpers/decorate.mjs";
import { IsInstanceOrArrayOfInstances, IsUri } from "../../../../utils/validators.mjs";
import "../../../../utils/index.mjs";
import { DidDocumentService } from "./DidDocumentService.mjs";
import { Type } from "class-transformer";
import { IsOptional, IsString, ValidateNested } from "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;
		}
	}
};
__decorate([
	IsString(),
	IsUri(),
	__decorateMetadata("design:type", String)
], DidCommV2ServiceEndpoint.prototype, "uri", void 0);
__decorate([
	IsString({ each: true }),
	IsOptional(),
	__decorateMetadata("design:type", Array)
], DidCommV2ServiceEndpoint.prototype, "routingKeys", void 0);
__decorate([
	IsString({ each: true }),
	IsOptional(),
	__decorateMetadata("design:type", Array)
], DidCommV2ServiceEndpoint.prototype, "accept", void 0);
var DidCommV2Service = class DidCommV2Service extends 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 CredoError("No entries in serviceEndpoint array");
			return this.serviceEndpoint[0].uri;
		}
		return this.serviceEndpoint.uri;
	}
};
DidCommV2Service.type = "DIDCommMessaging";
__decorate([
	IsInstanceOrArrayOfInstances({ classType: [DidCommV2ServiceEndpoint] }),
	ValidateNested(),
	Type(() => DidCommV2ServiceEndpoint),
	__decorateMetadata("design:type", Object)
], DidCommV2Service.prototype, "serviceEndpoint", void 0);

//#endregion
export { DidCommV2Service, DidCommV2ServiceEndpoint };
//# sourceMappingURL=DidCommV2Service.mjs.map