#ifndef SETTINGCONFIG_H
#define SETTINGCONFIG_H

#include <QVariant>
#include <QSettings>
#include <QApplication>

class SettingConfig : public QObject
{
public:
    ~SettingConfig() {};
    SettingConfig(const SettingConfig&)=delete;
    SettingConfig& operator=(const SettingConfig&)=delete;

    static SettingConfig& getInstance() {
        static SettingConfig instance;
        return instance;
    }

    /**
     * @brief get
     * @param nodeName
     * @param keyName
     * @return QVariant
     * @title
     */
    QVariant getProperty(QString nodeName, QString keyName);

    /******** 以下为需要的各类参数 ********/
    int BAUD_RATE;

    int NEED_KAFKA;
    QString KAFKA_BROKERS;
    QString KAFKA_DATA_TOPIC;
    QString KAFKA_STATUS_TOPIC;
    int NEED_SASL;
    QString SASL_USERNAME;
    QString SASL_PASSWORD;

    QString CLIENT_ID;
    QString APP_KEY;
    QString DEV_TYPES;
    QString SYSTEM;
    QString WORK_TYPE;
    int MASTER;
    quint16 SERVER_PORT;
    qint8 AUTO_STOP_TIME;
    qint8 AUTO_START_TIME;

    QString BASE_URL;

    QString BASE_LOG_PATH;

private:
    SettingConfig();

    QString filename;
    QSettings * setting;
};

#endif // SETTINGCONFIG_H
