#ifndef __APPCONTEXT_H__
#define __APPCONTEXT_H__

#include <QObject>
#include "pluginmanager.h"
#include "projectmanager.h"
#include "network.h"
#include "serialport.h"
#include "httpserver.h"
#include "datafifo.h"
#include "netparseprocess.h"
#include "calprocess.h"
#include "datadict.h"
#include "sysstate.h"
#include "mcumodule.h"

class AppContext : public QObject
{
    Q_OBJECT

    explicit AppContext(QObject *parent = nullptr);
    ~AppContext();

public:
    static AppContext &instance();
    PluginManager &pluginManager();
    ProjectManager &projectManager();
    Network &network();
    SerialPort &serialPort();
    HttpServer &httpServer();
    DataFifo &dataFifo();
    NetParseProcess &netParseProcess();
    CalProcess &calProcess();
    DataDict &dataDict();
    SysState &sysState();
    MCUModule &mcuModule();

private:
    PluginManager m_pluginMgr;
    ProjectManager m_projectMgr;
    Network m_network;
    SerialPort m_serialPort;
    HttpServer m_httpServer;
    DataFifo m_dataFifo;
    NetParseProcess m_netParseProcess;
    CalProcess m_calProcess;
    DataDict m_dataDict;
    SysState m_sysState;
    MCUModule m_mcuModule;
};

#endif  // APPCONTEXT_H