#ifndef ADDPRODUCTDIALOG_H
#define ADDPRODUCTDIALOG_H

#include "../databaseinfo/databaseinfo.h"

#include <QDialog>

namespace Ui {
class AddProductDialog;
}

class ColouredLineEdit;

class AddProductDialog : public QDialog {
  Q_OBJECT

private:
  ColouredLineEdit *m_nameLineEdit;
  ColouredLineEdit *m_barcodeLineEdit;
  Ui::AddProductDialog *m_ui;

private:
  int m_insertedId;

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

private:
  void createWidgets();
  void configureWidgets();

private:
  void createAttribute(int productId, DatabaseInfo::Attribute attribute);

private:
  void done(int resultCode) override;

public:
  int insertedId();
};

#endif // ADDPRODUCTDIALOG_H
