"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 {
    cradleService;
    constructor(cradleService){
        this.cradleService = cradleService;
    }
    createInstance(printerType) {
        const settingsStore = this.cradleService.resolve(_containertokens.DITokens.settingsStore);
        const serverSettings = settingsStore.getServerSettings();
        const moonrakerSupport = serverSettings.experimentalMoonrakerSupport;
        const prusaLinkSupport = serverSettings.experimentalPrusaLinkSupport;
        const bambuSupport = serverSettings.experimentalBambuSupport;
        if (printerType === _printerapiinterface.OctoprintType) {
            return this.cradleService.resolve(_containertokens.DITokens.octoPrintSockIoAdapter);
        } else if (moonrakerSupport && printerType === _printerapiinterface.MoonrakerType) {
            return this.cradleService.resolve(_containertokens.DITokens.moonrakerWebsocketAdapter);
        } else if (prusaLinkSupport && printerType === _printerapiinterface.PrusaLinkType) {
            return this.cradleService.resolve(_containertokens.DITokens.prusaLinkPollingAdapter);
        } else if (bambuSupport && printerType === _printerapiinterface.BambuType) {
            return this.cradleService.resolve(_containertokens.DITokens.bambuMqttAdapter);
        } else {
            throw new Error("PrinterType is unknown, cant pick the right socket adapter");
        }
    }
}

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