"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardCameraRunner = void 0;
var CELCIUS = 'ºC';
var DashboardCameraRunner = /** @class */ (function () {
    function DashboardCameraRunner(Main) {
        this.container = document.querySelector('.ntsh_dashboard-camerarunner');
        this.connectionStatus = this.container.querySelector('.ntsh_dashboard-camerarunner-connectedstatus');
        this.connectionInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-connectedinfo');
        this.processStatus = this.container.querySelector('.ntsh_dashboard-camerarunner-processstatus');
        this.processInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-processinfo');
        this.restartButton = this.container.querySelector('.ntsh_dashboard-camerarunner-restart');
        this.uptimeInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-uptimeinfo');
        this.errorContainer = this.container.querySelector('.ntsh_dashboard-camerarunner-error');
        this.errorText = this.container.querySelector('.ntsh_dashboard-camerarunner-errortext');
        this._Main = Main;
        this.registerListeners();
    }
    DashboardCameraRunner.prototype.updateState = function (state) {
        var _a;
        console.log(state);
        // ----------- Error -----------
        if (((_a = state === null || state === void 0 ? void 0 : state.error) !== null && _a !== void 0 ? _a : '').trim().length > 0) {
            this.errorText.innerText = state.error;
            this.errorContainer.style.display = 'block';
        }
        else {
            this.errorContainer.style.display = 'none';
            this.errorText.innerText = '';
        }
    };
    DashboardCameraRunner.prototype.registerListeners = function () {
        var _this = this;
        this._Main.socket.on('ledControllerState', function (state) {
            _this.updateState(state);
        });
    };
    return DashboardCameraRunner;
}());
exports.DashboardCameraRunner = DashboardCameraRunner;
//# sourceMappingURL=dashboard.ledcontroller.js.map