#ifndef VERIFICATIONWIDGET_H
#define VERIFICATIONWIDGET_H

#include <QWidget>

#include <QString>

namespace Ui {
class VerificationWidget;
}

class ColouredLineEdit;

class VerificationWidget : public QWidget {
  Q_OBJECT

public:
  enum LineEditFlag : int {
    LockOnCorrectInput = 0x01,
    LuminousAcceptableInput = 0x02,
    NoticeOnAcceptableInput = 0x04,
  };
  static constexpr LineEditFlag lineEditFlag() noexcept {
    auto result =
        LuminousAcceptableInput | LockOnCorrectInput | NoticeOnAcceptableInput;
    return static_cast<LineEditFlag>(result);
  }

private:
  static constexpr LineEditFlag m_lastLineEditFlag = NoticeOnAcceptableInput;

private:
  bool m_inputVerified;
  bool m_luminousAcceptableInput;
  bool m_luminousInvalidInput;
  LineEditFlag m_lineEditFlags;
  ColouredLineEdit *m_lineEdit;
  Ui::VerificationWidget *m_ui;

public:
  explicit VerificationWidget(QWidget *parent = nullptr,
                              LineEditFlag flags = lineEditFlag());
  ~VerificationWidget();

private:
  void createWidgets();
  void configureConnections();

private:
  bool checkWithEmit();
  void handleLineEditClassFlags(bool check);

public:
  bool inputVerified();
  void setReference(const QString &value);
  void setOldValueEnterText(const QString &value);
  void setFocus();
  void noticeRed();
  void setLineEditFlags(LineEditFlag flags);

signals:
  void benchmarkMatching(bool);
};

#endif // VERIFICATIONWIDGET_H
