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 { PublicKeyTransformer } from "./publicKey/index.mjs";
import { AuthenticationTransformer } from "./authentication/index.mjs";
import { DID_V1_CONTEXT_URL, DidCommV1Service, IndyAgentService, ServiceTransformer } from "@credo-ts/core";
import { Expose } from "class-transformer";
import { Equals, IsArray, IsString, ValidateNested } from "class-validator";

//#region ../didcomm/src/modules/connections/models/did/DidDoc.ts
var DidDoc = class {
	constructor(options) {
		this.context = DID_V1_CONTEXT_URL;
		this.publicKey = [];
		this.service = [];
		this.authentication = [];
		if (options) {
			this.id = options.id;
			this.publicKey = options.publicKey;
			this.service = options.service;
			this.authentication = options.authentication;
		}
	}
	/**
	* Gets the matching public key for a given key id
	*
	* @param id fully qualified key id
	*/
	getPublicKey(id) {
		return this.publicKey.find((item) => item.id === id);
	}
	/**
	* Returns all of the service endpoints matching the given type.
	*
	* @param type The type of service(s) to query.
	*/
	getServicesByType(type) {
		return this.service.filter((service) => service.type === type);
	}
	/**
	* Returns all of the service endpoints matching the given class
	*
	* @param classType The class to query services.
	*/
	getServicesByClassType(classType) {
		return this.service.filter((service) => service instanceof classType);
	}
	/**
	* Get all DIDComm services ordered by priority descending. This means the highest
	* priority will be the first entry.
	*/
	get didCommServices() {
		const didCommServiceTypes = [IndyAgentService.type, DidCommV1Service.type];
		return this.service.filter((service) => didCommServiceTypes.includes(service.type)).sort((a, b) => a.priority - b.priority);
	}
};
__decorate([
	Expose({ name: "@context" }),
	Equals("https://www.w3.org/ns/did/v1"),
	__decorateMetadata("design:type", Object)
], DidDoc.prototype, "context", void 0);
__decorate([IsString(), __decorateMetadata("design:type", String)], DidDoc.prototype, "id", void 0);
__decorate([
	IsArray(),
	ValidateNested(),
	PublicKeyTransformer(),
	__decorateMetadata("design:type", Array)
], DidDoc.prototype, "publicKey", void 0);
__decorate([
	IsArray(),
	ValidateNested(),
	ServiceTransformer(),
	__decorateMetadata("design:type", Array)
], DidDoc.prototype, "service", void 0);
__decorate([
	IsArray(),
	ValidateNested(),
	AuthenticationTransformer(),
	__decorateMetadata("design:type", Array)
], DidDoc.prototype, "authentication", void 0);

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