#pragma once

#include <QObject>

#include "QGeoCoordinate"

#include "WimaArea.h"

class WimaAreaData : public QObject // Abstract class for all WimaAreaData derived objects
{
    Q_OBJECT

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

    WimaAreaData(QObject *parent = nullptr);
    WimaAreaData& operator=(const WimaAreaData& otherData) = delete; // avoid slicing

    double                  maxAltitude()           const;
    QVariantList            path()                  const;
    QGeoCoordinate          center()                const;
    QList<QGeoCoordinate>   coordinateList()        const;
    bool                    containsCoordinate(const QGeoCoordinate &coordinate)    const;

    void append(const QGeoCoordinate &c)    {_path.push_back(QVariant::fromValue(c));}
    void clear()                            {_path.clear();}

    virtual QString         type()         const { return "Default";}

signals:
    void maxAltitudeChanged (double maxAltitude);
    void pathChanged        (const QVariantList& coordinateList);
    void centerChanged      (void);

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

protected:
    void assign(const WimaAreaData &other);
    void assign(const WimaArea    &other);

private:
    // Member Functions

    // Member Variables
    // see WimaArea.h for explanation
    double         _maxAltitude;
    QVariantList   _path;
    QGeoCoordinate _center;
};

