#ifndef DATAPARSER_H
#define DATAPARSER_H

#include "Systems/processingsystem.h"
#include "Systems/tools.h"
#include "Systems/assetsmanager.h"
#include "Systems/logger.h"
#include "Systems/Parsers/clientanswerparser.h"
#include "dbanswerparser.h"
#include "docsanswerparser.h"
#include "processparser.h"
#include "serverlmswidget.h"

#include <QByteArray>
#include <QXmlStreamReader>
#include <QDebug>
#include <QDomDocument>

#include <Data/typesDataServerClient.h>
#include <Data/StreamingVersionData.h>

class ProcessingSystem;
class ClientHandler;
class AssetsManager;
class ClientAnswerParser;
class DBAnswerParser;
class DocsAnswerParser;
class ProcessParser;

class DataParser : public QObject
{

  Q_OBJECT
public:
    DataParser(AssetsManager *assetManager,ProcessingSystem *processingSystem,QObject* parent = nullptr);
    void xmlParser(ClientHandler *client, QByteArray array);
    void xmlFileDataParse(QByteArray array);

    QByteArray xmlAnswer(QList<SXmlAnswerTag> listTag,QString elemUp1 = "", QString elemUp2 = "");

    ~DataParser();

    ClientAnswerParser *ClientAnswer() const;
    DBAnswerParser *DbAnswer() const;
    ProcessParser *getProcessParser() const;
    DocsAnswerParser *getDocsAnswerParser() const;

signals:
    void sigLogMessage(QString log);


private:
    QMutex *mutex;

    ProcessingSystem *processingSystem;
    AssetsManager *assetsManager;
    ClientAnswerParser *clientAnswer;
    DBAnswerParser *dbAnswer;
    DocsAnswerParser* docsAnswer;
    ProcessParser *processParser;
    QByteArray readTempFile();
};

#endif // DATAPARSER_H
