#pragma once

#include "GeoArea.h"
#include <QObject>

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

  Q_PROPERTY(
      QGeoCoordinate depot READ depotQml WRITE setDepot NOTIFY depotChanged)

  // Overrides from GeoArea
  QString mapVisualQML(void) const override;
  QString editorQML(void) const override;
  SafeArea *clone(QObject *parent = nullptr) const;
  void saveToJson(QJsonObject &json) override;
  bool loadFromJson(const QJsonObject &json, QString &errorString) override;
  Q_INVOKABLE virtual bool isCorrect();

  // Property acessors
  const QGeoCoordinate &depot(void) const;
  bool setDepot(const QGeoCoordinate &newDepot);
  QGeoCoordinate depotQml(void) const;

  // static Members
  static const char *safeAreaName;
  static const char *depotLatitudeName;
  static const char *depotLongitudeName;
  static const char *depotAltitudeName;
signals:
  void depotChanged(void);
private slots:
  void putDepotInside();

private:
  // Member Methodes
  void init();

  // Members
  QGeoCoordinate _depot;
};
