#ifndef WIMAFLYAREA_H
#define WIMAFLYAREA_H

#include <QObject>
#include "QGCMapPolygon.h"
#include "QmlObjectListModel.h"

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

    const WimaFlyArea& operator=(const WimaFlyArea& other);



    Q_PROPERTY(QmlObjectListModel*  polygons                            READ    polygons                                                    NOTIFY  polygonsChanged)
    Q_PROPERTY(QGCMapPolygon*       currentPolygonItem                  READ    currentPolygonItem                                          NOTIFY  currentPolygonItemChanged)
    Q_PROPERTY(int                  currentPolygonIndex                 READ    currentPolygonIndex                                         NOTIFY  currentPolygonIndexChanged)
    //Q_PROPERTY(QList<double>*       bottomLayerAltitude                 READ    bottomLayerAltitude     WRITE setBottomLayerAltitude        NOTIFY  bottomLayerAltitudeChanged)
    //Q_PROPERTY(QList<int>*          layerNumber                         READ    layerNumber             WRITE setLayerNumber                NOTIFY  layerNumberChanged)
    //Q_PROPERTY(QList<double>*       layerDistance                       READ    layerDistance           WRITE setLayerDistance              NOTIFY  layerDistanceChanged)

    Q_INVOKABLE void appendFlyAreaPolygon();
    Q_INVOKABLE void removeFlyAreaPolygon(int index);
    Q_INVOKABLE void selectCurrentPolygon(int index);
    Q_INVOKABLE void disselectAllPolygons();

    //  Property Accessors
    QmlObjectListModel *        polygons                        (void)        { return _polygons;}
    QGCMapPolygon *             currentPolygonItem              (void)        { return _currentPolygonItem;}
    int                         currentPolygonIndex             (void)        { return _currentPolygonIndex;}
    //QList<double>*              bottomLayerAltitude             (void)        { return _bottomLayerAltitude;}
    //QList<int>*                 layerNumber                     (void)        { return _layerNumber;}
    //QList<double>*              layerDistance                   (void)        { return _layerDistance;}

    // Property Writers
    //void setBottomLayerAltitude(double alt);
    //void setLayerNumber(int layerNumber);
    //void setLayerDistance(double dist);


    // Methodes
    void _init(void);

signals:
    void polygonsChanged(void);
    void currentPolygonItemChanged(QGCMapPolygon * polygon);
    void currentPolygonIndexChanged(int index);
    void bottomLayerAltitudeChanged(double alt);
    void layerNumberChanged(int alt);
    void layerDistanceChanged(double dist);


public slots:

private:



    QmlObjectListModel* _polygons;
    QGCMapPolygon*      _currentPolygonItem;
    int                 _currentPolygonIndex;
    bool                _visible;
    //QList<double>*      _bottomLayerAltitude;
    //QList<int>*         _layerNumber;
    //QList<double>*      _layerDistance;


};

#endif // WIMAFLYAREA_H
