#ifndef ISMASDATA_H
#define ISMASDATA_H

#include <QJsonObject>
#include <QJsonArray>




namespace ISMAS {

    struct TransferData : public QJsonObject {
        struct : public QJsonObject {
            QJsonValue tariffId;
            QJsonValue group;
            QJsonValue zone;
        } device;

        struct : public QJsonObject {
            QJsonValue state;
            QJsonValue uid;
            QJsonValue seq_tick_number;
            QJsonValue timestamp;
            QJsonValue userText;
            QJsonValue userTextType;
        } transaction;

        struct : public QJsonObject {
            // TODO: check what is really used at the moment
            QJsonValue id;          // unique article id
            QJsonValue name;        // name
            QJsonValue price;       // price in cent
            QJsonValue currency;    //
            QJsonValue startTime;   // start time
            QJsonValue endTime;     // end time
            QJsonValue userText;    // additional info
            QJsonValue parkingTime;
            QJsonValue printText;
            // QJsonValue discount;
        } item;

        struct : public QJsonObject {
            struct : public QJsonObject {
                QJsonValue coins;     // total amount of coins value
                // QJsonValue notes;     // total amount of notes value
                QJsonValue overpaid;  // in cent
                QJsonValue currency;
                QJsonValue change;
            } cash;

            struct : public QJsonObject {
                QJsonValue cardNumber;
                QJsonValue value;           // buchungsbetrag
                QJsonValue cardType;
                QJsonValue currency;
                QJsonValue tid;
                QJsonValue tresult;
            } card;

            struct : public QJsonObject {
                QJsonValue cardNumber;
                QJsonValue cardType;
                QJsonValue value;
                QJsonValue valueOld;
                QJsonValue valueNew;
                QJsonValue time;
                QJsonValue timeOld;
                QJsonValue timeNew;
            } prePaidCard;
        } payment;

        struct : public QJsonObject {
            QJsonValue delivery;    // PRINT, OnlineTicket
            QJsonValue result;      // SUCCESS, ERROR
            QJsonValue errorCode;   // 0=OK, 1=...
            QJsonValue errorMsg;
        } result;
    };


    struct AccountData : public QJsonObject {
        struct : public QJsonObject {
            QJsonValue UID;
            QJsonValue ChangeNumber;
            QJsonValue Process;         // Vorgang
            QJsonValue startDateTime;
            QJsonValue endDateTime;
            QJsonValue startHash;
            QJsonValue endHash;

            struct : public QJsonObject {
                QJsonValue value;          // coin value
                QJsonValue numberOfCoins;  // number of coins
                QJsonValue currency;
            } coin;

        } coinBox;                  // Münzkasse
    };


    struct EventData : public QJsonObject {
        struct : public QJsonObject {
            QJsonValue eventID;
            QJsonValue deviceName;
            QJsonValue reason;
            QJsonValue event;
            QJsonValue eventState;
            QJsonValue timeStamp;
            QJsonValue parameter;
            QJsonValue secondLevelInfo;
        } machineEvent;                  //
    };

    struct StateData : public QJsonObject {
        QJsonValue Timestamp;
        QJsonArray HW_States;
        struct : public QJsonObject {
            QJsonValue name;
            QJsonValue value;
            QJsonValue unit;
        } machineState;                  //
    };


    enum class REQUEST : quint8 {
        NO_REQUEST,
        START,
        STOP,
        PING,
        SELF,
        ISMAS_PARAMETER
    };
}



#endif // ISMASDATA_H