#pragma once

#include <thread>

#include "Operator.h"
#include "app/AppData.h"

class MqttClient;

class Application
{
public:
    static Application& instance()
    {
        static Application app;
        return app;
    }

    static AppData& data()
    {
        return Application::instance().appdata;
    }

    void init();

    Operator& getOperator() { return op; }

    void runThreadMain();

    void runThreadDevice();

    void runThreadStat();

public:
    bool isQuit = false;
    bool isInit = false;

    // 登录的管理员信息
    Operator op;

    // 应用数据
    AppData appdata;

    std::shared_ptr<MqttClient> mqttCli;
};