#ifndef TIMINGOFTRAINEE_H
#define TIMINGOFTRAINEE_H

#include <QString>
#include <QDateTime>
#include "DataBaseLMS_global.h"

class DATABASELMS_EXPORT TimingOfTrainee
{
public:
    TimingOfTrainee(int trainee_id);

    void setID(int timing_id){this->timing_id = timing_id;}
    int getID(){return timing_id;}

    void setTraineeID(int trainee_id){this->trainee_id = trainee_id;}
    int getTraineeID(){return trainee_id;}


    void setEntryTimeS(QString entry_time);
    void setEntryTime(QDateTime entry_time);

    QString getEntryTimeS(){return entryTime_str;}
    QDateTime getEntryTime(){return entryTime;}


    void setExitTimeS(QString exit_time);
    void setExitTime(QDateTime exit_time);

    QString getExitTimeS(){return exitTime_str;}
    QDateTime getExitTime(){return exitTime;}


    void setOperatingTimeS(QString operating_time);
    void setOperatingTime(QTime operating_time);

    QString getOperatingTimeS(){return operatingTime_str;}
    QTime getOperatingTime(){return operatingTime;}

    void fixEntry();
    void fixExit();

private:
    void calculateOperatingTime();

private:
    int timing_id;
    int trainee_id;

    QString entryTime_str;      //"yyyy-MM-dd hh:mm:ss.zzz"
    QString exitTime_str;       //"yyyy-MM-dd hh:mm:ss.zzz"
    QString operatingTime_str;  //"hh:mm:ss"

    QDateTime entryTime;
    QDateTime exitTime;
    QTime operatingTime;

    QDateTime dataTimeNull;
};

#endif // TIMINGOFTRAINEE_H
