#ifndef CALIBRATIONPARA_H
#define CALIBRATIONPARA_H

#include <QObject>
#include <QString>
#include <QJsonObject>
#include <QMap>

//#define MAX_PARA_ITEM  (5)

class ParaItem
{
public:
    ParaItem();
    ~ParaItem();

   int max_volume;   // L per unit
   int keep_time;    // s

   double outermax;
   double outermin;
   double outerkp;
   double outerki;
   double outerkd;

   double innermax;
   double innermin;
   double innerkp;
   double innerki;
   double innerkd;
   double innermaxI;
   double innerIstep;
   double innerDstep;
};



class CalibrationPara :public QObject
{
    Q_OBJECT
public:
    static CalibrationPara* instance();
    ~CalibrationPara();

    Q_INVOKABLE void init();

    Q_INVOKABLE QJsonObject get_paras();
    //add or modify
    Q_INVOKABLE bool set_paras(const QString& jsonStr);

    bool get_pidPara(int volume, ParaItem& item);

private:
    explicit CalibrationPara(QObject* parent = nullptr);

    void load_parameters();
    void save_parameters();
    void add_default();

    std::vector<ParaItem>  m_paras;


};

#define g_CalibrationPara  CalibrationPara::instance()

#endif // CALIBRATIONPARA_H
