"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "SocketFactory", {
    enumerable: true,
    get: function() {
        return SocketFactory;
    }
});
const _containertokens = require("../container.tokens");
const _printerapiinterface = require("./printer-api.interface");
class SocketFactory {
    cradle;
    constructor(cradle){
        this.cradle = cradle;
    }
    createInstance(printerType) {
        const settingsStore = this.cradle[_containertokens.DITokens.settingsStore];
        const serverSettings = settingsStore.getServerSettings();
        const moonrakerSupport = serverSettings.experimentalMoonrakerSupport;
        if (printerType === _printerapiinterface.OctoprintType) {
            return this.cradle[_containertokens.DITokens.octoPrintSockIoAdapter];
        } else if (moonrakerSupport && printerType === _printerapiinterface.MoonrakerType) {
            return this.cradle[_containertokens.DITokens.moonrakerWebsocketAdapter];
        } else {
            throw new Error("PrinterType is unknown, cant pick the right socket adapter");
        }
    }
}

//# sourceMappingURL=socket.factory.js.map