#ifndef COMMONVIEW_H
#define COMMONVIEW_H

#include <QTreeWidget>
#include <QTranslator>
#include <QMutex>
#include "instructorsAndTrainees_global.h"
#include "interfacedatabaselms.h"

//Родительский класс представления БД Инструкторов/Обучаемых (самого верхнего уровня)

class CommonView : public QWidget
{
    Q_OBJECT

public:
    enum TypeView
    {
        onlyView,
        control
    };

public:
    CommonView(InterfaceDataBaseLMS* dbLMS, TypeView type, QWidget *parent = nullptr);

public:
    void setAdminMode(bool adminMode)
    {
        this->adminMode = adminMode;
    }
    void setAuthComplited(bool authComplited)
    {
        this->authComplited = authComplited;
    }

protected:
    void setArchiveVisible(bool archiveVisible)
    {
        this->archiveVisible = archiveVisible;
    }
    void setNotLoggedInVisible(bool notLoggedInVisible)
    {
        this->notLoggedInVisible = notLoggedInVisible;
    }

    void setItemColorArchive(QTreeWidgetItem* item);
    void setItemColorNoArchive(QTreeWidgetItem* item);

    void setItemColor(QTreeWidgetItem* item, QColor color);

public:
    void updateMyStyleSheet();

private:
    QString loadStyleSheet();

protected:
    InterfaceDataBaseLMS* dbLMS;
    QTreeWidget* treeWidget;
    QMutex mtxTreeWidget;
    TypeView typeView;
    bool archiveVisible;
    bool notLoggedInVisible;
    bool adminMode;
    bool authComplited;
};

#endif // COMMONVIEW_H
