#ifndef INTERFACEDATABASELMS_H
#define INTERFACEDATABASELMS_H

#include <QObject>
#include <QWidget>
#include <QTranslator>

#include "DataBaseLMS_global.h"
#include "databaselms.h"

class DATABASELMS_EXPORT InterfaceDataBaseLMS : public DataBaseLMS
{
public:
    InterfaceDataBaseLMS(QWidget *ownerWidget, QObject *parent = nullptr);

public:
    //Соединение
    bool connectionToDB();
    bool disConnectionFromDB();
    bool DBisConnected();


    //Инструкторы

    bool authorizationInstructor(QString login, QString password);
    bool deAuthorizationInstructor(QString login);
    bool deAuthorizationAllInstructors();

    QString getNameInstructorByLogin(QString login);
    int getIdInstructorByLogin(QString login);

    QList<Instructor> getListInstructors();
    Instructor getInstructor(int id);

    int newInstructor();
    int delInstructor(int id);
    int editInstructor(Instructor instructor);

    bool isAdminInstructor(int id);
    bool isArchivedInstructor(int id);
    bool isLoggedInInstructor(int id);


    //Обучаемые

    bool authorizationTrainee(QString login, QString password, QString classroom_name, QString computer_name);
    bool deAuthorizationTrainee(QString login);
    bool deAuthorizationAllTrainees();    

    QString getNameTraineeOnComputer(QString computer_name);
    Trainee getTraineeOnComputer(QString computer_name);

    QString getNameTraineeByLogin(QString login);
    int getIdTraineeByLogin(QString login);

    QList<Trainee> getListTraineesInGroup(int id);
    QList<Group> getListGroups();
    QList<Trainee> getListTrainees();
    Trainee getTrainee(int id);

    int newTrainee(int id_group);
    int delTrainee(int id);
    int editTrainee(Trainee trainee);

    bool isArchivedTrainee(int id);
    bool isLoggedInTrainee(int id);

    //Регистрация тайминга Обучаемого
    int entryTraineeOnSimulator(int id_trainee);
    int exitTraineeFromSimulator(int id_trainee);


    //Группы

    Group getGroup(int group_id);
    int newGroup();
    int delGroup(int id);
    int editGroup(Group group);


    //Задачи

    int newTaskAMM(TaskAmmFim task, int id_trainee);
    int delTaskAMM(int id);
    int editTaskAMM(TaskAmmFim task);

    QList<TaskAmmFim> getListTasksAMMofTrainee(int id_trainee);
    QList<TaskAmmFim> getListTasksFIMofTrainee(int id_trainee);

    TaskAmmFim getTaskAMMbyID(int id_task);
    TaskAmmFim getTaskFIMbyID(int id_task);

    int newTaskFIM(TaskAmmFim task, int id_trainee);
    int delTaskFIM(int id);
    int editTaskFIM(TaskAmmFim task);
    int replaceReportFIM(TaskAmmFim task);
    int changeStatusTaskFIM(int id_task, QString status);
    int changeStatusTaskAMM(int id_task, QString status);

private:    
    QWidget* ownerWidget;
};

#endif // INTERFACEDATABASELMS_H
