#ifndef CAPPINFO_H
#define CAPPINFO_H

#include <memory>
#include <QString>
#include <QWidget>
#include "json/json.h"

namespace  EXAM_TYPES
{
    const QString ONLINE = "ONLINE";
    const QString PRACTICE = "PRACTICE";
    const QString OFFLINE = "OFFLINE";
}

class ExamInfo
{
public:
    bool bIsExamInProgress;//是否断点续考
    QString sExamType;
	QString sPracticeType;
	__int64 nExamId;
	__int64 nExamStudentId;
	__int64 nExamRecordDataId;
	QString sCourseCode;
	QString sCourseName;
	int nFaceVerifyMinute;	
    int nDuration;
    bool bFaceCheck;
    bool bLivenessCheck;    
    int nFaceThreshold;//人脸比对阈值
    bool bIsFaceCheck;//进入考试是否验证人脸识别(强制、非强制)
    bool bIsLivenessBefore;//考前活体检测
    int nSnapshotInterval;//抓拍间隔时间
    int nFaceVerifyStartMinute;//活体检测开始分钟数
    int nFaceVerifyEndMinute;//活体检测结束分钟数
    bool bIsStrangerEnable;//是否启用陌生人检测
    __int64 nFaceLiveVerifyId;//活体检测id
    int nFaceVerifyTimes;//活体检测次数
    int nFaceVerifyDoMinute;//活体检测时间后台随机
    int nActionNum;
    QString sActionOptions;//SHAKE,BLINK,NOD
    QString sActionOrder;//FIXED
    int nActionDuration;//单个动作最大时长
    int nActionAlert;//指定动作检测提醒N秒后开始检测
    int nAllActionDuration;//整体动作最大时长
    ExamInfo()
    {
        bIsExamInProgress = false;
        sExamType = "";
		sPracticeType = "";
		nExamId = 0;
		nExamStudentId = 0;
		nExamRecordDataId = 0;
		sCourseCode = "";
		sCourseName = "";
		nFaceVerifyMinute = 0;
        nDuration = 0;
        bFaceCheck = false;
        bLivenessCheck = false;
        nFaceThreshold = 50;
        bIsFaceCheck = false;
        nSnapshotInterval = 0;
        nFaceVerifyStartMinute = 0;
        nFaceVerifyEndMinute = 0;
        bIsStrangerEnable = false;
		nActionNum = 0;
		sActionOptions = "";
		sActionOrder = "";
		nActionDuration = 0;
        nAllActionDuration = 0;
		nActionAlert = 0;
		nFaceLiveVerifyId = 0;
		nFaceVerifyDoMinute = 0;
		nFaceVerifyTimes = 0;
    }
};

class CAppInfo
{
public:
    CAppInfo();

    double m_fRate;
    QString m_sQssStr;

	QString m_sEscDomain;//ecs域名
	QString m_sOrgPrefix;//org域名前缀
    QString m_sHttpServer;
    QString m_sHttpPort;

	bool m_bDisableMutiScreen;//禁止全屏
	bool m_bDisableRemoteAssistance;//远程协助
    bool m_bInprogressCheckRemoteAssistance;//过程中检测远程协助
	bool m_bFullScreenTop;//屏幕前置
	bool m_bDisableVirtualCamera;//虚拟摄像头
	QString m_sRootOrgId;
    QString m_sRootOrgName;
	bool m_bShowQmthLogo;
    QString m_sMenuLogoUrl;
	bool m_bShowStudentClientAppQrcode;
	bool m_bWeiXinAnswerEnabled;//是否开启微信作答
	Json::Value m_jAudioPlayedCount;

    bool m_bShowStudentName;
    bool m_bShowStudentCode;
    bool m_bShowStudentIdentity;
    bool m_bMutipleAnserCountTips;

	__int64 m_nStudentId;
	QString m_sStudentName;
	__int64 m_nOrgId;
	QString m_sOrgCode;
	QString m_sOrgName;
	QString m_sStudentCode;
	QString m_sStudentIdentityNumber;
	QString m_sStudentPhotoPath;
	bool m_bStudentEnable;
	QString m_sSpecialtyName;

	QString m_sAppDownLoadUrl;//app下载地址

    ExamInfo m_oExamInfo;
    QWidget* m_pAnsBgWidget;
    //过程中活体检测失败是否退出考试
    bool m_bInprogressFaceLivenessFailedForceExit;

    //检查当前考生是否跳过人脸识别接口
    bool m_bSkipFaceCheck;

	int m_nVersionId;
	QString m_sVersionCode;
	QString m_sMachineId;
    QString m_sUpgradeUrl;//升级文件url

	QString m_sCacheFileDir;
    __int64 m_nRecordId;

    bool m_bShowDebugInfo;//是否显示debug日志
    __int64 serverMTime();

    std::map<QString, QString> m_FileCacheMap ;
};

extern std::shared_ptr<CAppInfo> g_appInfoPtr;

#endif // CAPPINFO_H