#pragma once

#include <QObject>

#include <functional>
#include <memory>

#include "snake.h"

#include "Wima/WimaPlanData.h"

namespace routing {

class GeneratorBase : public QObject {
  Q_OBJECT
public:
  using Data = std::shared_ptr<WimaPlanData>;
  using Generator = std::function<bool(snake::Transects &)>;

  explicit GeneratorBase(QObject *parent = nullptr);
  explicit GeneratorBase(Data d, QObject *parent = nullptr);
  ~GeneratorBase();

  Q_PROPERTY(QString editorQml READ editorQml CONSTANT)
  Q_PROPERTY(QString mapVisualQml READ mapVisualQml CONSTANT)

  virtual QString editorQml();
  virtual QString mapVisualQml();

  virtual QString name() = 0;
  virtual QString abbreviation() = 0;

  virtual bool get(Generator &generator) = 0;

  Data data() const;
  void setData(const Data &d);

signals:
  void generatorChanged();

protected:
  virtual void establishConnections();
  virtual void deleteConnections();
  Data _d;
};

} // namespace routing
