#ifndef FORMERRORCODENOTE_H
#define FORMERRORCODENOTE_H

#include <QWidget>
#include <QTableWidgetItem>

#include "BaseWidget.h"
#include "DataTypeDef.h"
#include "OtherSettings/dialog/DialogErrorNoteCode.h"

namespace Ui {
class FormErrorCodeNote;
}

class FormErrorCodeNote : public BaseWidget
{
    Q_OBJECT

public:
    explicit FormErrorCodeNote(BaseWidget *parent = nullptr);
    ~FormErrorCodeNote();

    bool returnParent() override;

private:
    void initWidget();
    void initConnect();

    void refreshData();
    void appendTableWidgetItem(const ERROR_NOTE& error_info);
    void updateData();
    void updateData(const ERROR_NOTE& data, const int& index);

protected:
    void showEvent(QShowEvent* event) override;

private slots:
    void addBtnClicked();
    void deleteBtnClicked();
    void tableWidgetItemDoubleClicked(QTableWidgetItem* item);

private:
    Ui::FormErrorCodeNote *ui;
    QSharedPointer<DialogErrorNoteCode> m_error_dialog;
    TCU_CFG m_tcu_cfg;
};

#endif // FORMERRORCODENOTE_H
