#ifndef TASKTREEPREPARATION_H
#define TASKTREEPREPARATION_H

#include <QObject>
#include <QTreeWidgetItem>
#include <QDomElement>
#include "module.h"

enum ColumnsTree{
    clmn_PMorDM = 0,
    clmn_code,
    clmn_ID
};

class TaskTreePreparation : public QObject
{
    Q_OBJECT
public:
    explicit TaskTreePreparation(QObject *parent = nullptr);
    ~TaskTreePreparation();

private:
    QTreeWidgetItem* addModuleToTreeWidget(Module* module, QTreeWidgetItem* parentItem = nullptr);
    void loadAMMtasksFromXML(QByteArray array);
    void domElementParser(QDomElement element, Module* moduleParent);
    void deleteAllModuls();

public Q_SLOTS:
    void slot_prepareListItems(QByteArray array, QList<Module*>* listAllModules);

Q_SIGNALS:
    void signal_listItemsReady(QList<QTreeWidgetItem*> listItems);

private:
    QList<QTreeWidgetItem*> listItems;
    QList<Module*>* listAllModules;
};

#endif // TASKTREEPREPARATION_H
