#ifndef FORMCHARGEDETAIL_H
#define FORMCHARGEDETAIL_H

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

#include "DataTypeDef.h"

namespace Ui {
class FormChargeDetail;
}

class FormChargeDetail : public QWidget
{
    Q_OBJECT

public:
    explicit FormChargeDetail(QWidget *parent = nullptr);
    ~FormChargeDetail();

    void setBackground(const QString& imageUrl);
    void setTipsBackground(const QString& imageUrl);

    void setChargeGunDetail(int index);

    void setGunType(uint8_t newGun_type = GUNTYPE_NACS);

    void setAuthenticationResult(const bool& result);

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::FormChargeDetail *ui;
    QLabel* backgroundImage;
    QLabel* tipsBackGroundImage;

    bool isStart;
    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;
};

#endif // FORMCHARGEDETAIL_H
