#ifndef CLONLINEEXAM_H
#define CLONLINEEXAM_H

#include <QWidget>
#include <QTimer>
#include "clObjectiveScore.h"
#include "CHttpBll.h"
#include "clOperation.h"


namespace Ui {
class clOnlineExam;
}

class clOnlineExam : public QWidget
{
    Q_OBJECT
signals:
    void enterExam(CL_OPERATION_TYPE cot, __int64 nExamId, __int64 nExamStudentId,
                   QString sCourseCode, QString sCourseName);
public:
    explicit clOnlineExam(QWidget *parent = nullptr);
    ~clOnlineExam();

    void setUI(const int nWidth, const int nHeight);
    void refreshExam();
private slots:
	void onQueryExamList(CQueryExamList queryExamList);
	void onQueryExamEndList(CQueryExamEndList queryExamEndList);	
    void on_btn_examList_clicked();

    void on_btn_endExamList_clicked();
    void on_btn_refresh_clicked();

private:
	void showEvent(QShowEvent *event);

    QString getWeekCycles(std::vector<int> vWeek);

    Ui::clOnlineExam *ui;

	std::shared_ptr<QTimer> m_pObjectiveScoreTimer;
    std::shared_ptr<QTimer> m_pRefreshTimer;
    std::shared_ptr<clObjectiveScore> m_pObjectiveScore;
	std::vector<CExamCourseInfo> m_vOnlieExamList;
    std::vector<CExamCourseInfo> m_vOnlieEndExamList;

    int m_nRefreshSeconds = 20;
};

#endif // CLONLINEEXAM_H
