#ifndef APPLICATION_H
#define APPLICATION_H
#include "http/http_svr.h"
#include "mqtt/mqtt_cli.h"
#include "report_svr/report_svr.h"
#include "oss/oss.h"
#include "device_holder.h"

namespace zsy
{

    class Application
    {
        const std::string configFile;
        std::string pidFilePath;
        std::string pid;
        static HANDLE STOP_EVENT;

        nlohmann::json config;

        void loadConfig();

        void writePid();

    public:
        static std::shared_ptr<ThreadPool> threadPool;

        static std::shared_ptr<EventManager> eventManager;

        static std::shared_ptr<HttpSvr> httpSvr;

        static std::shared_ptr<MqttCliHolder> mqttCliHolder;

        static std::shared_ptr<OSS> oss;

        static std::shared_ptr<ReportSvr> reportSvr;

        static std::shared_ptr<DeviceHolder> deviceHolder;

        Application();

        static void run();

        static void stop();

        ~Application();
    };
} // zsy

#endif //APPLICATION_H
