#ifndef COURSELIST_H
#define COURSELIST_H

#include <QWidget>
#include <QTimer>

#include "clNoticePopWidget.h"
#include "clMobileLogin.h"
#include "clStudentInfo.h"
#include "clNoticeDetail.h"
#include "clopResultList.h"
#include "welcomeWidget.h"
#include "privacyWidget.h"
#include "clopReport.h"
#include "etWhetherEnvTest.h"
#include "faceCompare.h"
#include "cloeUploadFile.h"
#include "awBackground.h"
#include "clOnlineExam.h"
#include "clOnlineHomework.h"
#include "clOnlinePractice.h"
#include "clOfflineExam.h"
#include "clNoticeList.h"
#include "clEditPassword.h"
#include "CHttpBll.h"
#include "environmentalTest.h"
#include "faceLiveness.h"

namespace Ui {
class courseList;
}

enum class COURSE_MENU_BTN_TYPE
{
    cmbt_online_exam = 1,
    cmbt_online_homework,
    cmbt_online_practice,
    cmbt_offline_exam,
    cmbt_notice,
    cmbt_edit_password
};

class courseList : public QWidget
{
    Q_OBJECT

public:
    explicit courseList(QWidget *parent = nullptr);
    ~courseList();
signals:
    void minisize();
private slots:
    void on_btn_minisize_clicked();
    void on_btn_cl_close_clicked();
    void on_btn_onlineExam_clicked();
    void on_btn_onlineHomework_clicked();
    void on_btn_onlinePractice_clicked();
    void on_btn_offlineExam_clicked();
    void on_btn_notice_clicked();
    void on_btn_editPassword_clicked();

    void on_btn_exit_clicked();

    void hideStudentInfoBtn();
    void hideMobileLoginBtn();
    //进入考试
    void onEnterExam(CL_OPERATION_TYPE cot, __int64 nExamId, __int64 nExamStudentId, 
		QString sCourseCode, QString sCourseName);

	void onAppDownLoadUrl(CAppDownLoadUrl appDownLoadUrl);
	void onDownLoadFile(CDownLoadFileInfo downLoadFileInfo);
	void onGetStudentInfoBySession(CGetStudentInfoBySession getStudentInfoBySession);
	void onSpecialtyNameList(CSpecialtyNameList specialtyNameList);
	void onCheckExamInProgress(CCheckExamInProgress checkExamInProgress);
	void onGetStudentClientMenu(CGetStudentClientMenu getStudentClientMenu);
	void onGetUserNoticeList(CGetUserNoticeList getUserNoticeList);
	void onStartExamLimit(CStartExamLimit startExamLimit);
	void onIpLimit(CIpLimit ipLimit);
	void onGetExamProperty(CGetExamProperty getExamProperty);
	void onFaceCheckEnabled(CFaceCheckEnabled faceCheckEnabled);
	void onLivenessEnabled(CLivenessEnabled livenessEnabled);
    void onGetOrgPropertiesByGroupWithoutCache(CGetOrgPropertiesByGroupWithoutCache orgProperties);

    void onEndExam(CEndExam endExam);

private:
    void initUI();
    void setCheck(COURSE_MENU_BTN_TYPE cmbt);
    bool eventFilter(QObject *obj, QEvent *ev);
	void menuBtnRePosistion();
	void getStudentInfoBySession();
	void logout();
	void enterWaitExam();
    void GetOrgPropertiesByGroupWithoutCache();
    void doFaceCompare();
    void doLiveness();
    void getExamProperty();

    Ui::courseList *ui;

	std::shared_ptr<QTimer> m_pStudentInfoBtnTimer;
	std::shared_ptr<QTimer> m_pMobileLoginBtnTimer;
	std::shared_ptr<QTimer> m_pServerTime;
	std::shared_ptr<QTimer> m_pRefreshMenuTimer;
	std::shared_ptr<QTimer> m_pOnlineTimer;
    std::shared_ptr<clNoticePopWidget> m_pNoticePopWidget;
    std::shared_ptr<clMobileLogin> m_pMobileLogin;
    std::shared_ptr<clStudentInfo> m_pStudentInfo;
    std::shared_ptr<clNoticeDetail> m_pNoticeDetail;
    std::shared_ptr<clopResultList> m_pClopResultList;
    std::shared_ptr<welcomeWidget> m_pWelcomeWidget;
    std::shared_ptr<privacyWidget> m_pPrivacyWidget;
	std::shared_ptr<clOnlineExam> m_pOnlineExam;
	std::shared_ptr<clOnlineHomework> m_pOnlineHomework;
	std::shared_ptr<clOnlinePractice> m_pOnlinePractice;
	std::shared_ptr<clOfflineExam> m_pOfflineExam;
	std::shared_ptr<clNoticeList> m_pNoticeList;
	std::shared_ptr<clEditPassword> m_pEditPassword;
    std::shared_ptr<clopReport> m_pClopReport;
    std::shared_ptr<etWhetherEnvTest> m_pWhetherEnvTest;
    std::shared_ptr<environmentalTest> m_pEnvironmentalTest;
    std::shared_ptr<faceCompare> m_pFaceCompare;
//    std::shared_ptr<cloeUploadFile> m_pCloeUploadFile;
    std::shared_ptr<awBackground> m_pBackground;
    std::shared_ptr<awResumeExam> m_pResumeExam;
    std::shared_ptr<faceLiveness> m_pFaceLiveness;
    int m_nRetryCount = 0;
};

#endif // COURSELIST_H
