#ifndef FORMPLUGIN_H
#define FORMPLUGIN_H

#include <QWidget>
#include <QLabel>
#include <QTimer>

#include "DataTypeDef.h"

namespace Ui {
class FormPlugIn;
}

class FormPlugIn : public QWidget
{
    Q_OBJECT

public:
    explicit FormPlugIn(int gun_id, QWidget *parent = nullptr);
    ~FormPlugIn();

    void setChargeGunDetail(int index);

    void setGunType(uint8_t newGun_type = GUNTYPE_NACS);

    void setAuthenticationResult(const bool& result);

    void refreshChargingBackground();

private slots:
    void slotControlButtonCLicked();
    void authTimeout();
    void globalsValueChanged(const QString& key, const QVariant& value);

private:
    void initWidget();
    void initConnect();
    void displayChargeGunDetail(const CHARGING_INFO &info);
    void displayGunBasicInfo(const BASIC_INFO &info);

signals:
    void authentication();

private:
    Ui::FormPlugIn *ui;

    bool isStart;
    uint32_t m_gun_num;
    uint32_t m_gun_id;
    uint8_t m_gun_type;
    bool m_auth_result;
    QTimer* m_timer;

    QStringList m_gun_variable_names;
    QStringList m_charge_variable_names;

    ccu_config_info_t m_ccu_cfg;
};

#endif // FORMPLUGIN_H
