#pragma once

#include <QObject>

#include "QGeoCoordinate"

#include "WimaArea.h"

class WimaAreaData
    : public QObject // Abstract class for all WimaAreaData derived objects
{
  Q_OBJECT
public:
  WimaAreaData(QObject *parent = nullptr);

  Q_PROPERTY(const QVariantList path READ path NOTIFY pathChanged)
  Q_PROPERTY(QString type READ type CONSTANT)
  Q_PROPERTY(QString mapVisualQML READ mapVisualQML CONSTANT)

  bool operator==(const WimaAreaData &data) const;
  bool operator!=(const WimaAreaData &data) const;

  virtual QString mapVisualQML(void) const = 0;

  QVariantList path() const;
  QGeoCoordinate center() const;
  const QList<QGeoCoordinate> &coordinateList() const;
  bool containsCoordinate(const QGeoCoordinate &coordinate) const;
  virtual QString type() const = 0;

  void append(const QGeoCoordinate &c);
  void push_back(const QGeoCoordinate &c);
  void clear();

signals:
  void pathChanged();
  void centerChanged();

public slots:
  void setPath(const QList<QGeoCoordinate> &coordinateList);
  void setPath(const QVariantList &coordinateList);
  void setCenter(const QGeoCoordinate &center);

protected:
  WimaAreaData(const WimaAreaData &otherData, QObject *parent);
  WimaAreaData(const WimaArea &otherData, QObject *parent);
  WimaAreaData &operator=(const WimaAreaData &otherData);
  WimaAreaData &operator=(const WimaArea &otherData);

private:
  void _setPathImpl(const QList<QGeoCoordinate> &coordinateList);
  void _setPathImpl(const QVariantList &coordinateList);
  // Member Variables
  mutable QVariantList _path;
  QList<QGeoCoordinate> _list;
  QGeoCoordinate _center;
};

bool operator==(const WimaAreaData &m1, const WimaArea &m2);
bool operator!=(const WimaAreaData &m1, const WimaArea &m2);
bool operator==(const WimaArea &m1, const WimaAreaData &m2);
bool operator!=(const WimaArea &m1, const WimaAreaData &m2);
