#ifndef DATAPARSER_H
#define DATAPARSER_H

#include "FileData.h"
#include "recognizesystem.h"

#include <QObject>
#include <Datas.h>
#include <QFile>
#include <QXmlStreamWriter>

class RecognizeSystem;

class DataParser : public QObject
{

    Q_OBJECT

public:
    explicit DataParser(QObject *parent = 0);
    void initialize(RecognizeSystem *recognizeSystem);
    ~DataParser();
    ServerSettings* getServerSettings();
    void createServerSettings(ServerSettings* serverSettings);
    void saveClientSettrings(QString language,bool isAutoStart);
    void createFileDataList(QList<FileData> fileDataList,QString filename);
    void createAuthMessage(ClientAutorization *auth);
    void createAuthData(ServerAuthorization *serverAuth);
    void createAuthDataOffline(QString username,QString pass);
    void addRunData(QList<int> displays);    
    QByteArray xmlAnswer(QList<SXmlAnswerTag> listTag, QString elemUp1 = "", QString elemUp2 = "");
    QList<FileData>* xmlFileDataParse(QByteArray array,QString filter);

    void xmlParser(QByteArray array);
    void changeVersion(QString versionName);
public slots:
    QByteArray xmlAnswer_notify(QString code);


private:
    const QString XMLLanguageProperty = "Language=\"";
    const QString XMLAutoStartProperty = "AutoStart=\"";
    ClientAutorization *authPassCache;
    RecognizeSystem *recognizeSystem;

};

#endif // DATAPARSER_H
