#ifndef CHTTPBLL_H
#define CHTTPBLL_H

#include "CHttpInterceptor.h"

#include <QObject>
//#include "logproc.h"

class CHttpBll :public QObject , public CHttpInterceptor
{
    Q_OBJECT
signals:
    void sgnTokenExpired();
    void sgnUpgrade(CUpgrade upgrade);
	void sgnDownLoadFile(CDownLoadFileInfo downLoadFileInfo);
    void sgnAgreement(CAgreement agreement);
    void sgnGetSoftwareConfig(CGetSoftwareConfig getSoftwareConfig);
	void sgnStudentClientConfig(CStudentClientConfig studentClientConfig);
	void sgnSysNotice(CSysNotice sysNotice);
	void sgnLoginLimit(CLoginLimit loginLimit);
	void sgnLoginInfo(CLoginInfo loginInfo);
	void sgnLogout(CLogout logout);
	void sgnEditPassword(CEditPassword editPassword);
	void sgnGetStudentClientMenu(CGetStudentClientMenu getStudentClientMenu);
	void sgnGetStudentInfoBySession(CGetStudentInfoBySession getStudentInfoBySession);
	void sgnSpecialtyNameList(CSpecialtyNameList specialtyNameList);
    void sgnUpdateNoticeReadStatus(CUpdateNoticeReadStatus updateNoticeReadStatus);
	void sgnGetUserNoticeList(CGetUserNoticeList getUserNoticeList);
	void sgnAppDownLoadUrl(CAppDownLoadUrl appDownLoadUrl);
	void sgnAppEnabled(CAppEnabled appEnabled);
	void sgnQueryBatchList(CQueryBatchList queryBatchList);
	void sgnGetExamProperty(CGetExamProperty getExamProperty);
	void sgnStartExamLimit(CStartExamLimit startExamLimit);
	void sgnIpLimit(CIpLimit ipLimit);
	void sgnStartExam(CStartExam startExam);
	void sgnFaceCheckEnabled(CFaceCheckEnabled faceCheckEnabled);
	void sgnLivenessEnabled(CLivenessEnabled livenessEnabled);
	void sgnWeiXinAnswerEnabled(CWeiXinAnswerEnabled weiXinAnswerEnabled);
	void sgnGetExamById(CGetExamById getExamById);
	void sgnStartAnswer(CStartAnswer startAnswer);
    void sgnSubmitQuestionAnswer(CSubmitQuestionAnswer submitQuestionAnswer);
	void sgnGetQuestion(CGetQuestion getQuestion);
	void sgnGetQuestionContent(CGetQuestionContent getQuestionContent);
	void sgnQueryExamList(CQueryExamList queryExamList);
	void sgnQueryExamEndList(CQueryExamEndList queryExamEndList);
	void sgnQueryObjectiveScoreList(CQueryObjectiveScoreList queryObjectiveScoreList);
	void sgnQueryHomeworkList(CQueryHomeworkList queryHomeworkList);
	void sgnQueryPracticeCourseList(CQueryPracticeCourseList queryPracticeCourseList);
	void sgnQueryPracticeRecordList(CQueryPracticeRecordList queryPracticeRecordList);
	void sgnGetPracticeDetailInfo(CGetPracticeDetailInfo getPracticeDetailInfo);
	void sgnFindExamRecordDataEntity(CFindExamRecordDataEntity findExamRecordDataEntity);
	void sgnGetExamRecordQuestions(CGetExamRecordQuestions getExamRecordQuestions);
	void sgnGetOfflineCourse(CGetOfflineCourse getOfflineCourse);
	void sgnGetOffLineExamAnswerSheet(CGetOffLineExamAnswerSheet getOffLineExamAnswerSheet);
	void sgnStartOfflineExam(CStartOfflineExam startOfflineExam);
	void sgnGetOffLineExamPaper(CGetOffLineExamPaper getOffLineExamPaper);
	void sgnPreviewOffLineExamPaper(CPreviewOffLineExamPaper previewOffLineExamPaper);
	void sgnSubmitOfflinePaper(CSubmitOfflinePaper submitOfflinePaper);
	void sgnCheckExamInProgress(CCheckExamInProgress checkExamInProgress);
    void sgnGetCourseInfo(CGetCourseInfo getCourseInfo);
	void sgnEndExam(CEndExam endExam);
	void sgnGetEndExamInfo(CGetEndExamInfo getEndExamInfo);
	void sgnExamHeartbeat(CExamHeartbeat examHeartbeat); 
	void sgnFindExamQuestionList(CFindExamQuestionList findExamQuestionList);
	void sgnGetExamRecordPaperStruct(CGetExamRecordPaperStruct getExamRecordPaperStruct);
	void sgnGetWXQrCode(CGetWXQrCode getWXQrCode);
	void sgnSaveUploadedFileAcknowledgeStatus(CSaveUploadedFileAcknowledgeStatus saveUploadedFileAcknowledgeStatus);
//	void sgnProcessUpload(CProcessUpload processUpload); //文件上传
	void sgnSaveFaceCompareResult(CBaseResponsePackage res);//保存人脸识别比对验证结果
	void sgnSaveFaceCaptureResult(CBaseResponsePackage res);//保存人脸抓拍比对验证结果
	void sgnSaveFaceLiveVerifyResult(CBaseResponsePackage res);//保存人脸活体验证结果
	void sgnGetOrgPropertiesByGroupWithoutCache(CGetOrgPropertiesByGroupWithoutCache orgProperties);
	void sgnStartFaceLiveVerify(CStartFaceLiveVerify startFaceLiveVerify);
    void sgnClientExamProcessUploadSign(CClientExamProcessUploadSign clientExamProcessUploadSign);
    void sgnUploadFileToAliyun(CUploadFileToAliyun uploadFileToAliyun);
    void sgnExamControlCheckTime(CBaseResponsePackage res);
public:
    CHttpBll();

    void requestProc(CHttpRequestPackage requestPkg);

	QString getToken();
	QString getKey();
    QString getAuthorization(QString sUri, QString sTimeStamp);
private:
    void genUpgrade(CUpgrade *pUpgrade, const std::string &sResponse);
    void genAgreement(CAgreement *pAgreement, const std::string &sResponse);
    void genSoftwareConfig(CGetSoftwareConfig *pSoftwareConfig, const std::string &sResponse);
	void genStudentClientConfig(CStudentClientConfig *pStudentClientConfig, const std::string &sResponse);
	void genSysNotice(CSysNotice *pSysNotice, const std::string &sResponse);    
	void genLoginLimit(CLoginLimit *pLoginLimit, const std::string &sResponse);
	void genLoginInfo(CLoginInfo *pLoginInfo, const std::string &sResponse);
	void genLogout(CLogout *pLogout, const std::string &sResponse);
	void genEditPassword(CEditPassword *pEditPassword, const std::string &sResponse);
	void genGetStudentClientMenu(CGetStudentClientMenu *pGetStudentClientMenu, const std::string &sResponse);
	void genGetStudentInfoBySession(CGetStudentInfoBySession *pGetStudentInfoBySession, const std::string &sResponse);
	void genSpecialtyNameList(CSpecialtyNameList *pSpecialtyNameList, const std::string &sResponse);

	void genGetUserNoticeList(CGetUserNoticeList *pGetUserNoticeList, const std::string &sResponse);
	void genAppDownLoadUrl(CAppDownLoadUrl *pAppDownLoadUrl, const std::string &sResponse);
	void genAppEnabled(CAppEnabled *pAppEnabled, const std::string &sResponse);
	void genQueryBatchList(CQueryBatchList *pQueryBatchList, const std::string &sResponse);
	void genGetExamProperty(CGetExamProperty *pGetExamProperty, const std::string &sResponse);
	void genStartExamLimit(CStartExamLimit *pStartExamLimit, const std::string &sResponse);
	void genIpLimit(CIpLimit *pIpLimit, const std::string &sResponse);
	void genStartExam(CStartExam *pStartExam, const std::string &sResponse);
	void genFaceCheckEnabled(CFaceCheckEnabled *pFaceCheckEnabled, const std::string &sResponse);
	void genLivenessEnabled(CLivenessEnabled *pLivenessEnabled, const std::string &sResponse);
	void genWeiXinAnswerEnabled(CWeiXinAnswerEnabled *pWeiXinAnswerEnabled, const std::string &sResponse);
	void genGetExamById(CGetExamById *pGetExamById, const std::string &sResponse);
	void genStartAnswer(CStartAnswer *pStartAnswer, const std::string &sResponse);
    void genSubmitQuestionAnswer(CSubmitQuestionAnswer submitQuestionAnswer, const std::string &sResponse);
	void genGetQuestion(CGetQuestion *pGetQuestion, const std::string &sResponse);
	void genGetQuestionContent(CGetQuestionContent *pGetQuestionContent, const std::string &sResponse);
	void genQueryExamList(CQueryExamList *pQueryExamList, const std::string &sResponse);
	void genQueryExamEndList(CQueryExamEndList *pQueryExamEndList, const std::string &sResponse);
	void genQueryObjectiveScoreList(CQueryObjectiveScoreList *pQueryObjectiveScoreList, const std::string &sResponse);
	void genQueryHomeworkList(CQueryHomeworkList *pQueryHomeworkList, const std::string &sResponse);
	void genQueryPracticeCourseList(CQueryPracticeCourseList *pQueryPracticeCourseList, const std::string &sResponse);
	void genQueryPracticeRecordList(CQueryPracticeRecordList *pQueryPracticeRecordList, const std::string &sResponse);
	void genGetPracticeDetailInfo(CGetPracticeDetailInfo *pGetPracticeDetailInfo, const std::string &sResponse);
	void genFindExamRecordDataEntity(CFindExamRecordDataEntity *pFindExamRecordDataEntity, const std::string &sResponse);
	void genGetExamRecordQuestions(CGetExamRecordQuestions *pGetExamRecordQuestions, const std::string &sResponse);
	void genGetOfflineCourse(CGetOfflineCourse *pGetOfflineCourse, const std::string &sResponse);
	void genGetOffLineExamAnswerSheet(CGetOffLineExamAnswerSheet *pGetOffLineExamAnswerSheet, const std::string &sResponse);
	void genGetOffLineExamPaper(CGetOffLineExamPaper *pGetOffLineExamPaper, const std::string &sResponse);
	void genPreviewOffLineExamPaper(CPreviewOffLineExamPaper *pPreviewOffLineExamPaper, const std::string &sResponse);
	void genCheckExamInProgress(CCheckExamInProgress *pCheckExamInProgress, const std::string &sResponse);
    void genGetCourseInfo(CGetCourseInfo *pGetCourseInfo, const std::string &sResponse);
	void genExamHeartbeat(CExamHeartbeat *pExamHeartbeat, const std::string &sResponse);
	void genFindExamQuestionList(CFindExamQuestionList *pFindExamQuestionList, const std::string &sResponse);
	void genGetExamRecordPaperStruct(CGetExamRecordPaperStruct *pGetExamRecordPaperStruct, const std::string &sResponse);
	void genGetEndExamInfo(CGetEndExamInfo *pGetEndExamInfo, const std::string &sResponse);
	void genGetWXQrCode(CGetWXQrCode *pGetWXQrCode, const std::string &sResponse);
//	void genProcessUpload(CProcessUpload *pProcessUpload, const std::string &sResponse);
	void genGetOrgPropertiesByGroupWithoutCache(CGetOrgPropertiesByGroupWithoutCache *pOrgProperties, const std::string &sResponse);
	void genStartFaceLiveVerify(CStartFaceLiveVerify *pStartFaceLiveVerify, const std::string &sResponse);
    void genClientExamProcessUploadSign(CClientExamProcessUploadSign *pClientExamProcessUploadSign, const std::string &sResponse);

	void genExamCourseInfo(const Json::Value &jExamItem, CExamCourseInfo &eci);

	QString sKey;
    QString sToken;
};

extern std::shared_ptr<CHttpBll> g_httpBllPtr;

#endif // CHTTPBLL_H
