"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MeshClientRegistry = void 0;
const tslib_1 = require("tslib");
const _a = tslib_1.__importStar(require("@zyno-io/ts-server-foundation/type-metadata-runtime"));
const __tsf_metadata_type = _a.createCompactMetadataRegistryV1("[1,[{\"kind\":6},{\"kind\":8},{\"kind\":22,\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"status\",\"type\":{\"kind\":10,\"literal\":\"ok\"},\"optional\":false},{\"kind\":20,\"name\":\"supersededNodeId\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":5}]},\"optional\":false}]},{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"status\",\"type\":{\"kind\":10,\"literal\":\"conflict\"},\"optional\":false},{\"kind\":20,\"name\":\"ownerNodeId\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":5}]},\"optional\":false}]}],\"typeName\":\"RegisterResult\"}},{\"kind\":22,\"type\":{\"kind\":8}},{\"kind\":7}]]", []);
let _MeshClientRegistryMetadata_1;
class MeshClientRegistry {
    nodeId;
    backend;
    constructor(nodeId, backend) {
        this.nodeId = nodeId;
        this.backend = backend;
    }
    async register(clientId, metadata, allowSupersede) {
        return this.backend.register(clientId, this.nodeId, metadata, allowSupersede);
    }
    async reserve(clientId, metadata, allowSupersede) {
        return this.backend.reserve(clientId, this.nodeId, metadata, allowSupersede);
    }
    async activate(clientId, metadata) {
        return this.backend.activate(clientId, this.nodeId, metadata);
    }
    async unregister(clientId) {
        return this.backend.unregister(clientId, this.nodeId);
    }
    async updateMetadata(clientId, metadata) {
        return this.backend.updateMetadata(clientId, this.nodeId, metadata);
    }
    async getClient(clientId) {
        return this.backend.getClient(clientId);
    }
    async listClients() {
        return this.backend.listClients();
    }
    async listClientsForNode(nodeId) {
        return this.backend.listClientsForNode(nodeId ?? this.nodeId);
    }
    async cleanupNode(nodeId) {
        return this.backend.cleanupNode(nodeId ?? this.nodeId);
    }
    static __tsfType = _MeshClientRegistryMetadata_1 = _a.decodeCompactMetadataV1("[1,{\"kind\":16,\"name\":\"MeshClientRegistry\",\"typeName\":\"MeshClientRegistry\",\"classType\":{\"$tsf\":0},\"properties\":[],\"methods\":[{\"name\":\"register\",\"parameters\":[{\"name\":\"clientId\",\"type\":{\"$tsfType\":0},\"optional\":false,\"default\":false},{\"name\":\"metadata\",\"type\":{\"kind\":16,\"typeName\":\"TMeta\",\"classType\":{\"$tsf\":1}},\"optional\":false,\"default\":false},{\"name\":\"allowSupersede\",\"type\":{\"$tsfType\":1},\"optional\":true,\"default\":false}],\"returnType\":{\"$tsfType\":2}},{\"name\":\"reserve\",\"parameters\":[{\"name\":\"clientId\",\"type\":{\"$tsfType\":0},\"optional\":false,\"default\":false},{\"name\":\"metadata\",\"type\":{\"kind\":16,\"typeName\":\"TMeta\",\"classType\":{\"$tsf\":1}},\"optional\":false,\"default\":false},{\"name\":\"allowSupersede\",\"type\":{\"$tsfType\":1},\"optional\":true,\"default\":false}],\"returnType\":{\"$tsfType\":2}},{\"name\":\"activate\",\"parameters\":[{\"name\":\"clientId\",\"type\":{\"$tsfType\":0},\"optional\":false,\"default\":false},{\"name\":\"metadata\",\"type\":{\"kind\":16,\"typeName\":\"TMeta\",\"classType\":{\"$tsf\":1}},\"optional\":false,\"default\":false}],\"returnType\":{\"$tsfType\":3}},{\"name\":\"unregister\",\"parameters\":[{\"name\":\"clientId\",\"type\":{\"$tsfType\":0},\"optional\":false,\"default\":false}],\"returnType\":{\"$tsfType\":3}},{\"name\":\"updateMetadata\",\"parameters\":[{\"name\":\"clientId\",\"type\":{\"$tsfType\":0},\"optional\":false,\"default\":false},{\"name\":\"metadata\",\"type\":{\"kind\":16,\"typeName\":\"TMeta\",\"classType\":{\"$tsf\":1}},\"optional\":false,\"default\":false}],\"returnType\":{\"$tsfType\":3}},{\"name\":\"getClient\",\"parameters\":[{\"name\":\"clientId\",\"type\":{\"$tsfType\":0},\"optional\":false,\"default\":false}],\"returnType\":{\"kind\":22,\"type\":{\"kind\":12,\"types\":[{\"kind\":16,\"typeName\":\"RegisteredClient\",\"classType\":{\"$tsfImport\":[2,\"./types\",\"RegisteredClient\"]},\"typeArguments\":[{\"kind\":16,\"typeName\":\"TMeta\",\"classType\":{\"$tsf\":1}}]},{\"kind\":4}]}}},{\"name\":\"listClients\",\"parameters\":[],\"returnType\":{\"kind\":22,\"type\":{\"kind\":14,\"type\":{\"kind\":16,\"typeName\":\"RegisteredClient\",\"classType\":{\"$tsfImport\":[2,\"./types\",\"RegisteredClient\"]},\"typeArguments\":[{\"kind\":16,\"typeName\":\"TMeta\",\"classType\":{\"$tsf\":1}}]}}}},{\"name\":\"listClientsForNode\",\"parameters\":[{\"name\":\"nodeId\",\"type\":{\"$tsfType\":4},\"optional\":true,\"default\":false}],\"returnType\":{\"kind\":22,\"type\":{\"kind\":14,\"type\":{\"kind\":16,\"typeName\":\"RegisteredClient\",\"classType\":{\"$tsfImport\":[2,\"./types\",\"RegisteredClient\"]},\"typeArguments\":[{\"kind\":16,\"typeName\":\"TMeta\",\"classType\":{\"$tsf\":1}}]}}}},{\"name\":\"cleanupNode\",\"parameters\":[{\"name\":\"nodeId\",\"type\":{\"$tsfType\":4},\"optional\":true,\"default\":false}],\"returnType\":{\"kind\":22,\"type\":{\"kind\":14,\"type\":{\"kind\":16,\"typeName\":\"RegisteredClient\",\"classType\":{\"$tsfImport\":[2,\"./types\",\"RegisteredClient\"]},\"typeArguments\":[{\"kind\":16,\"typeName\":\"TMeta\",\"classType\":{\"$tsf\":1}}]}}}}],\"hasConstructor\":true,\"constructorParameters\":[{\"name\":\"nodeId\",\"type\":{\"$tsfType\":4},\"optional\":false,\"default\":false},{\"name\":\"backend\",\"type\":{\"kind\":16,\"typeName\":\"MeshClientRegistryBackend\",\"classType\":{\"$tsfImport\":[2,\"./types\",\"MeshClientRegistryBackend\"]},\"typeArguments\":[{\"kind\":16,\"typeName\":\"TMeta\",\"classType\":{\"$tsf\":1}}]},\"optional\":false,\"default\":false}]}]", [() => MeshClientRegistry, () => (typeof TMeta !== "undefined" ? TMeta : (typeof exports !== "undefined" ? exports.TMeta : undefined)), require], __tsf_metadata_type);
}
exports.MeshClientRegistry = MeshClientRegistry;
_MeshClientRegistryMetadata_1.classType = MeshClientRegistry;
MeshClientRegistry.__tsfType = _MeshClientRegistryMetadata_1;
//# sourceMappingURL=mesh-client-registry.js.map