#pragma once

#include <map>
#include <string>

struct AppOption
{
    int debug {0};
    std::string webSrvUrl;
    std::string lunchDate;
    std::string exportpath;

    struct {
        std::string host;
        int port;
        std::string user;
        std::string passwd;
        std::string dbname;
    } database;

    struct {
        bool enabled {true};
        int useToken {1};
        int port {0};
        int encryption {1};
        std::string encryptKey;
    } http;

    struct {
        bool enabled {true};
        std::string host;
        std::string username;
        std::string password;
        int interval {60};
    } mqtt;

    struct {
        float latitude {0};
        float longitude {0};
        float altitude {0};
    } view;

    struct VideoInfo {
        std::string host;
        int port;
        std::string user;
        std::string passwd;
    };

    std::map<std::string, VideoInfo> mapVideo;

    int windowEnabled {0};

    struct {
        int enabled {0};
        int interval {60};
    } stat;
};

class Config
{
public:
    static bool init(std::string filename);
    
    static AppOption::VideoInfo* getVideoInfo(std::string name);

    static AppOption option;
};