#ifndef PROCESSPARSER_H
#define PROCESSPARSER_H

#include <QObject>
#include <qxmlstream.h>
#include <clienthandler.h>
#include "Data/typesDataServerClient.h"

class ProcessParser : public QObject
{
    Q_OBJECT
public:
    explicit ProcessParser(QObject *parent = nullptr);
    void initialize(ProcessingSystem *processingSystem);

public slots:
    void slot_read(ClientHandler *client, QByteArray array);

signals:
    void sigLogMessage(QString text);

    //void sigStatusTasksAMMofTraineeChanged(int trainee_id);
    //void sigStatusTasksFIMofTraineeChanged(int trainee_id);
private:
    ProcessingSystem *processingSystem;
    void clientAuth(QXmlStreamReader &xmlReader,ClientHandler *client);
    void clientDeAuth(QXmlStreamReader &xmlReader,ClientHandler *client);
    void clientBlockAuth(QXmlStreamReader &xmlReader,ClientHandler *client);
    void toClientMessage(QXmlStreamReader &xmlReader,ClientHandler *client);
    void queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client, QByteArray array = QByteArray());
    void queryTasksXML(QXmlStreamReader &xmlReader,ClientHandler *client);
    void queryListSubProc(QXmlStreamReader &xmlReader,ClientHandler *client);
    void clientMessage(QXmlStreamReader &xmlReader,ClientHandler *client);
    void clientNotify(QXmlStreamReader &xmlReader,ClientHandler *client);
    void clientDataInfo(QXmlStreamReader &xmlReader, ClientHandler *client);
    void clientUnityTaskAMMreport(QXmlStreamReader &xmlReader,ClientHandler *client, QByteArray array = QByteArray());
    void clientUnityTaskFIMreport(QXmlStreamReader &xmlReader,ClientHandler *client, QByteArray array = QByteArray());

    TaskAmmFim xmlParserQueryToDB_ASSIGN_TASK_FIM_TO_TRAINEE(QByteArray array);
    TaskAmmFim xmlParserQueryToDB_ASSIGN_TASK_AMM_TO_TRAINEE(QByteArray array);
};

#endif // PROCESSPARSER_H
