import { __decorateMetadata } from "../../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateMetadata.mjs";
import { __decorate } from "../../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.mjs";
import { TypedArrayEncoder, utils, verkeyToPublicJwk } from "@credo-ts/core";
import { IsArray, IsOptional, IsString } from "class-validator";

//#region ../didcomm/src/decorators/service/ServiceDecorator.ts
/**
* Represents `~service` decorator
*
* Based on specification Aries RFC 0056: Service Decorator
* @see https://github.com/hyperledger/aries-rfcs/tree/master/features/0056-service-decorator
*/
var ServiceDecorator = class ServiceDecorator {
	constructor(options) {
		if (options) {
			this.recipientKeys = options.recipientKeys;
			this.routingKeys = options.routingKeys;
			this.serviceEndpoint = options.serviceEndpoint;
		}
	}
	get resolvedDidCommService() {
		return {
			id: utils.uuid(),
			recipientKeys: this.recipientKeys.map(verkeyToPublicJwk),
			routingKeys: this.routingKeys?.map(verkeyToPublicJwk) ?? [],
			serviceEndpoint: this.serviceEndpoint
		};
	}
	static fromResolvedDidCommService(service) {
		return new ServiceDecorator({
			recipientKeys: service.recipientKeys.map((k) => TypedArrayEncoder.toBase58(k.publicKey.publicKey)),
			routingKeys: service.routingKeys.map((k) => TypedArrayEncoder.toBase58(k.publicKey.publicKey)),
			serviceEndpoint: service.serviceEndpoint
		});
	}
};
__decorate([
	IsArray(),
	IsString({ each: true }),
	__decorateMetadata("design:type", Array)
], ServiceDecorator.prototype, "recipientKeys", void 0);
__decorate([
	IsArray(),
	IsString({ each: true }),
	IsOptional(),
	__decorateMetadata("design:type", Array)
], ServiceDecorator.prototype, "routingKeys", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], ServiceDecorator.prototype, "serviceEndpoint", void 0);

//#endregion
export { ServiceDecorator };
//# sourceMappingURL=ServiceDecorator.mjs.map