#ifndef TOOLS_H
#define TOOLS_H

#include "logger.h"

#include <QString>
#include <QDebug>
#include <QTime>
#include <QDir>
#include <QDomDocument>

#include <Data/StreamingVersionData.h>

#define TCP_READ_TIMEOUT 5000

static const QString staticDataFolderName = "StaticData";
static const QString applicationFolderName = "Application";
static const QString sharedDataFolderName = "SharedData";
static const QString projectFolderName = "RRJLoader";
static const QString additionalFilesFolderName = "RRJ-95NEW-100";
static const QString rusScensFolderName = "RUS/Scens";
static const QString streamingAssetsFolderName = "StreamingAssets";
static const QString versionFolderName = "StreamingVersion";
static const QString tempFile = staticDataFolderName + "/save.xml";
static const QString version = staticDataFolderName + "/version.xml";
static const QString versionListFile = staticDataFolderName + "/versionList.xml";
static const QString hashFileName = staticDataFolderName + "/serverHash.xml";
static const QString buildHashName = staticDataFolderName + "/buildHash.xml";
static const QString buildDataPath = "/Application/" + projectFolderName + "/RRJ_Data/";
static const QString tasksAMMfileName = "/docs.xml";   //"/tasksAmm.xml";
static const QString tasksFIMfileName = "/tasksFIM.xml";
//static const QString clientHash = staticDataFolderName + "/clientHash.xml";
static const QString logFolderPath = "log";

static const QString configFolderName = "config";
static const QString settingsName = configFolderName + "/settings.xml";

static const QString baseNameVersion = "base";//может вынести комманды куда нибудь?

static const QString commandTryBaseDelete = "BASEDELETETRY";
static const QString commandTryBaseChange = "TRYBASECHANGE";
static const QString commandTryActiveDelete = "TRYACTIVEDELETE";
static const QString commandTryCopyWithSameNames = "SAMENAMES";
static const QString commandGetServerDataList = "GETSERVERDATALIST";
static const QString commandCheckVersionList = "CHECKVERSIONLIST";
static const QString commandReadyClient = "READY";
static const QString commandDisableClient = "DISABLE";
static const QString commandStartTimerClient = "UNITYSTARTTIMER";
static const QString commandDuplicateVerName = "DUPLICATEVERNAME";
static const QString commandHashCompleteClient = "HASHSENDCOMPLETE";
static const QString commandCanChangeVersion = "CANCHANGE";
static const QString commandChangable = "CHANGEABLE";
static const QString commandUnchangable = "UNCHANGEABLE";
static const QString commandUpdateFilesClient = "update";
static const QString commandGetTasks = "GETTASKS";
static const QString commandeGetOfflineMessages = "GETOFFLINEMESSAGE";

//static quint64 fileBlockSize = 1460;
static quint64 sendFileBlockSize = 256000;
static quint64 readFileBlockSize = 65535;
//1025*250

class Tools {
public:
    static void printTime();
    static QString getTime();
    static QString createLocalPath(QString path);
    static QString createRootPath(QString path);
    static QString createUpdateFilePath(QString path);
    static QString createFolderPath(QString path);
    static QString createSharedPath(QString path);
    static QString createRealPath(QString path,StreamingVersionData* currentVersionData);
    static QString createStreamingToRealPath(QString path, StreamingVersionData *streamingVersionData);
    static QString createVersionHashFilepath(QString fileName);
    static QString createFullPath(QString path);
    static bool checkNonStaticData(QString path);

    static bool loadXMLtoDOM(QString pathNameFile, QDomDocument* commonDOM);
    static bool saveDOMtoXML(QString pathNameFile, QDomDocument* commonDOM);
};


#endif // TOOLS_H
