#pragma once

#include "geometry/GeoArea.h"

#include <QGeoCoordinate>

class MeasurementTile : public GeoArea {
  Q_OBJECT
public:
  MeasurementTile(QObject *parent = nullptr);
  MeasurementTile(const MeasurementTile &other, QObject *parent = nullptr);
  ~MeasurementTile();

  MeasurementTile &operator=(const MeasurementTile &other);

  Q_PROPERTY(double progress READ progress NOTIFY progressChanged)

  virtual QString mapVisualQML() const override;
  virtual QString editorQML() const override;
  virtual MeasurementTile *clone(QObject *parent) const override;

  void push_back(const QGeoCoordinate &c);

  double progress() const;
  void setProgress(double progress);

  QString id() const;
  void setId(const QString &id);

  QList<QGeoCoordinate> tile() const;

  static QString randomId(int length = 10);

  // Static Variables
  static const char *settingsGroup;
  static const char *nameString;

signals:
  void progressChanged();
  void idChanged();

private:
  void init();
  double _progress;
  QString _id;
};
