#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 WimaPolygon
  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;

  // Property acessors
  const QGeoCoordinate &depot(void) const;
  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);

public slots:
  bool setDepot(const QGeoCoordinate &coordinate);

private:
  // Member Methodes
  void init();

  // Members
  QGeoCoordinate _depot;
};
