"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const types_1 = require("@deepstream/types");
const distributed_state_registry_1 = require("./distributed-state-registry");
class DistributedStateRegistryFactory extends types_1.DeepstreamPlugin {
    constructor(pluginConfig, services, config) {
        super();
        this.pluginConfig = pluginConfig;
        this.services = services;
        this.config = config;
        this.description = 'Distributed State Registry';
        this.stateRegistries = new Map();
        this.getStateRegistry = (topic) => {
            let stateRegistry = this.stateRegistries.get(topic);
            if (!stateRegistry) {
                stateRegistry = new distributed_state_registry_1.DistributedStateRegistry(topic, this.pluginConfig, this.services, this.config);
                this.stateRegistries.set(topic, stateRegistry);
            }
            return stateRegistry;
        };
    }
    getStateRegistries() {
        return this.stateRegistries;
    }
}
exports.DistributedStateRegistryFactory = DistributedStateRegistryFactory;
//# sourceMappingURL=distributed-state-registry-factory.js.map