#pragma once

#include <QGeoCoordinate>
#include <QObject>

#include "Geometry/WimaAreaData.h"
#include "Geometry/WimaCorridorData.h"
#include "Geometry/WimaJoinedAreaData.h"
#include "Geometry/WimaMeasurementAreaData.h"
#include "Geometry/WimaServiceAreaData.h"
#include "MissionItem.h"

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

  // Member Methodes
  void set(const WimaJoinedAreaData &areaData);
  void set(const WimaServiceAreaData &areaData);
  void set(const WimaCorridorData &areaData);
  void set(const WimaMeasurementAreaData &areaData);

  void set(const WimaJoinedArea &areaData);
  void set(const WimaServiceArea &areaData);
  void set(const WimaCorridor &areaData);
  void set(const WimaMeasurementArea &areaData);
  void clear();

  const WimaJoinedAreaData &joinedArea() const;
  const WimaServiceAreaData &serviceArea() const;
  const WimaCorridorData &corridor() const;
  const WimaMeasurementAreaData &measurementArea() const;

  WimaJoinedAreaData &joinedArea();
  WimaServiceAreaData &serviceArea();
  WimaCorridorData &corridor();
  WimaMeasurementAreaData &measurementArea();

  QGeoCoordinate origin();
  bool isValid();

  bool operator==(const WimaPlanData &other) const;
  bool operator!=(const WimaPlanData &other) const;

signals:
  void joinedAreaChanged();
  void serviceAreaChanged();
  void corridorChanged();
  void measurementAreaChanged();
  void originChanged();

private:
  void setOrigin(const QGeoCoordinate &origin);

  WimaJoinedAreaData _joinedArea;
  WimaServiceAreaData _serviceArea;
  WimaCorridorData _corridor;
  WimaMeasurementAreaData _measurementArea;

  QGeoCoordinate _origin;
};
