#ifndef PACKETTYPE_H
#define PACKETTYPE_H

#include <QString>


enum PacketType
{
    TYPE_NONE = 0,
    TYPE_UNITY = 1,
    TYPE_FILE = 2,
    TYPE_COMMAND =3,
    TYPE_FOLDER = 4,
    TYPE_DELETE = 5,
    TYPE_FINISH = 6,
    TYPE_NEEDUPDATE = 7,
    TYPE_XMLANSWER = 8,
    TYPE_QT = 9,
    TYPE_DISABLE = 11,
    TYPE_UPDATE = 12,
    TYPE_CHECK_VERSION = 13,
    TYPE_FILESIZE = 20,
    TYPE_BIGXML = 21,

    TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90,

    //xml-ответы на запросы к БД
    TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS = 100,
    TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS = 101,
    TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES = 102,
    TYPE_XMLANSWER_QUERY_DB__LIST_COMPUTERS = 103,
    TYPE_XMLANSWER_QUERY_DB__LIST_CLASSROOMS = 104,

    TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE = 106,
    TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE = 107,

    //xml-ответы на запросы AdditionalFiles
    TYPE_XMLANSWER_QUERY_TASKS_XML_FIM = 130,
    TYPE_XMLANSWER_QUERY_TASKS_XML_AMM = 131,

    //ответы по обновлениям
    HASH_READY = 150,
    CHANGE_DATA_VERSION = 151,
    COPY_VERSION = 152,
    DELETE_DATA_VERSION = 153,
    BUSY = 154,
    FREE = 155,
    HASH_CALCULATE_START = 156,

};
template<typename T>
QString enumToString(T value);

template<>
inline QString enumToString(PacketType value) {
    switch(value) {
        case PacketType::TYPE_NONE: return "TYPE_NONE";
        case PacketType::TYPE_UNITY: return "TYPE_UNITY";
        case PacketType::TYPE_FILE: return "TYPE_FILE";
        case PacketType::TYPE_COMMAND: return "TYPE_COMMAND";
        case PacketType::TYPE_FOLDER: return "TYPE_FOLDER";
        case PacketType::TYPE_DELETE: return "TYPE_DELETE";
        case PacketType::TYPE_FINISH: return "TYPE_FINISH";
        case PacketType::TYPE_NEEDUPDATE: return "TYPE_NEEDUPDATE";
        case PacketType::TYPE_XMLANSWER: return "TYPE_XMLANSWER";
        case PacketType::TYPE_QT: return "TYPE_QT";
        case PacketType::TYPE_DISABLE: return "TYPE_DISABLE";
        case PacketType::TYPE_UPDATE: return "TYPE_UPDATE";
        case PacketType::TYPE_CHECK_VERSION: return "TYPE_CHECK_VERSION";
        case PacketType::TYPE_FILESIZE: return "TYPE_FILESIZE";
        case PacketType::TYPE_BIGXML: return "TYPE_BIGXML";
        case PacketType::CHANGE_DATA_VERSION: return "CHANGE_DATA_VERSION";
        case PacketType::COPY_VERSION: return "COPY_VERSION";
        case PacketType::DELETE_DATA_VERSION: return "DELETE_DATA_VERSION";
        case PacketType::BUSY: return "BUSY";
        case PacketType::FREE: return "FREE";
        case PacketType::HASH_CALCULATE_START: return "HASH_CALCULATE_START";
        case PacketType::HASH_READY: return "HASH_READY";

        default: return "Unknown";
    }
}
#endif // PACKETTYPE_H
