#ifndef REPORT_H
#define REPORT_H

#include "tank.h"
#include "Deviceinfo.h"
#include<QThread>
#include<windows.h>

#define BOOKMARK_COMPANYNAME        "bm_companyname"
#define BOOKMARK_CARPLATE           "bm_carplate"
#define BOOKMARK_COMPARTMENT_NUM    "bm_compartment_num"

#define BOOKMARK_VOLUME_1    "bm_volume_1"
#define BOOKMARK_VOLUME_2    "bm_volume_2"
#define BOOKMARK_VOLUME_3    "bm_volume_3"
#define BOOKMARK_VOLUME_4    "bm_volume_4"


// bookmarks for  vrs inspection check
#define BOOKMARK_VRS_CHECK_ITEMS_1_0   "bm_vrs_check_1_0"
#define BOOKMARK_VRS_CHECK_ITEMS_1_1   "bm_vrs_check_1_1"
#define BOOKMARK_VRS_CHECK_ITEMS_1_2   "bm_vrs_check_1_2"

#define BOOKMARK_VRS_CHECK_ITEMS_2_0   "bm_vrs_check_2_0"
#define BOOKMARK_VRS_CHECK_ITEMS_2_1   "bm_vrs_check_2_1"
#define BOOKMARK_VRS_CHECK_ITEMS_2_2   "bm_vrs_check_2_2"

#define BOOKMARK_VRS_CHECK_ITEMS_3_0   "bm_vrs_check_3_0"
#define BOOKMARK_VRS_CHECK_ITEMS_3_1   "bm_vrs_check_3_1"
#define BOOKMARK_VRS_CHECK_ITEMS_3_2   "bm_vrs_check_3_2"

#define BOOKMARK_VRS_CHECK_ITEMS_4_0   "bm_vrs_check_4_0"
#define BOOKMARK_VRS_CHECK_ITEMS_4_1   "bm_vrs_check_4_1"
#define BOOKMARK_VRS_CHECK_ITEMS_4_2   "bm_vrs_check_4_2"

#define BOOKMARK_VRS_CHECK_ITEMS_5_0   "bm_vrs_check_5_0"
#define BOOKMARK_VRS_CHECK_ITEMS_5_1   "bm_vrs_check_5_1"
#define BOOKMARK_VRS_CHECK_ITEMS_5_2   "bm_vrs_check_5_2"

#define BOOKMARK_VRS_CHECK_ITEMS_6_0   "bm_vrs_check_6_0"
#define BOOKMARK_VRS_CHECK_ITEMS_6_1   "bm_vrs_check_6_1"
#define BOOKMARK_VRS_CHECK_ITEMS_6_2   "bm_vrs_check_6_2"

#define BOOKMARK_VRS_CHECK_ITEMS_7_0   "bm_vrs_check_7_0"
#define BOOKMARK_VRS_CHECK_ITEMS_7_1   "bm_vrs_check_7_1"
#define BOOKMARK_VRS_CHECK_ITEMS_7_2   "bm_vrs_check_7_2"

#define BOOKMARK_VRS_CHECK_ITEMS_8_0   "bm_vrs_check_8_0"
#define BOOKMARK_VRS_CHECK_ITEMS_8_1   "bm_vrs_check_8_1"
#define BOOKMARK_VRS_CHECK_ITEMS_8_2   "bm_vrs_check_8_2"

// bookmarks for  bls inspection check
#define BOOKMARK_BLS_CHECK_ITEMS_1_0   "bm_bls_check_1_0"
#define BOOKMARK_BLS_CHECK_ITEMS_1_1   "bm_bls_check_1_1"
#define BOOKMARK_BLS_CHECK_ITEMS_1_2   "bm_bls_check_1_2"

#define BOOKMARK_BLS_CHECK_ITEMS_2_0   "bm_bls_check_2_0"
#define BOOKMARK_BLS_CHECK_ITEMS_2_1   "bm_bls_check_2_1"
#define BOOKMARK_BLS_CHECK_ITEMS_2_2   "bm_bls_check_2_2"

#define BOOKMARK_BLS_CHECK_ITEMS_3_0   "bm_bls_check_3_0"
#define BOOKMARK_BLS_CHECK_ITEMS_3_1   "bm_bls_check_3_1"
#define BOOKMARK_BLS_CHECK_ITEMS_3_2   "bm_bls_check_3_2"

#define BOOKMARK_BLS_CHECK_ITEMS_4_0   "bm_bls_check_4_0"
#define BOOKMARK_BLS_CHECK_ITEMS_4_1   "bm_bls_check_4_1"
#define BOOKMARK_BLS_CHECK_ITEMS_4_2   "bm_bls_check_4_2"

#define BOOKMARK_BLS_CHECK_ITEMS_5_0   "bm_bls_check_5_0"
#define BOOKMARK_BLS_CHECK_ITEMS_5_1   "bm_bls_check_5_1"
#define BOOKMARK_BLS_CHECK_ITEMS_5_2   "bm_bls_check_5_2"

#define BOOKMARK_SYSTEST_STARTPRESSURE_1    "bm_sysPS_1"
#define BOOKMARK_SYSTEST_STARTPRESSURE_2    "bm_sysPS_2"
#define BOOKMARK_SYSTEST_STARTPRESSURE_3    "bm_sysPS_3"
#define BOOKMARK_SYSTEST_STARTPRESSURE_4    "bm_sysPS_4"

#define BOOKMARK_SYSTEST_ENDPRESSURE_1    "bm_sysPE_1"
#define BOOKMARK_SYSTEST_ENDPRESSURE_2    "bm_sysPE_2"
#define BOOKMARK_SYSTEST_ENDPRESSURE_3    "bm_sysPE_3"
#define BOOKMARK_SYSTEST_ENDPRESSURE_4    "bm_sysPE_4"

#define BOOKMARK_SYSTEST_DELTAPRESSURE_1    "bm_sysPD_1"
#define BOOKMARK_SYSTEST_DELTAPRESSURE_2    "bm_sysPD_2"
#define BOOKMARK_SYSTEST_DELTAPRESSURE_3    "bm_sysPD_3"
#define BOOKMARK_SYSTEST_DELTAPRESSURE_4    "bm_sysPD_4"

#define BOOKMARK_SYSTEST_THRESHOLD_1    "bm_sysPT_1"
#define BOOKMARK_SYSTEST_THRESHOLD_2    "bm_sysPT_2"
#define BOOKMARK_SYSTEST_THRESHOLD_3    "bm_sysPT_3"
#define BOOKMARK_SYSTEST_THRESHOLD_4    "bm_sysPT_4"

#define BOOKMARK_SYSTEST_RESULT  "bm_sys_result"
#define BOOKMARK_SYSTEST_PASS  "bm_sys_pass"
#define BOOKMARK_SYSTEST_EXCEEDED  "bm_sys_exceeded"

#define BOOKMARK_VALVETEST_STARTPRESSURE_1    "bm_valvePS_1"
#define BOOKMARK_VALVETEST_STARTPRESSURE_2    "bm_valvePS_2"
#define BOOKMARK_VALVETEST_STARTPRESSURE_3    "bm_valvePS_3"
#define BOOKMARK_VALVETEST_STARTPRESSURE_4    "bm_valvePS_4"

#define BOOKMARK_VALVETEST_ENDPRESSURE_1    "bm_valvePE_1"
#define BOOKMARK_VALVETEST_ENDPRESSURE_2    "bm_valvePE_2"
#define BOOKMARK_VALVETEST_ENDPRESSURE_3    "bm_valvePE_3"
#define BOOKMARK_VALVETEST_ENDPRESSURE_4    "bm_valvePE_4"

#define BOOKMARK_VALVETEST_DELTAPRESSURE_1    "bm_valvePD_1"
#define BOOKMARK_VALVETEST_DELTAPRESSURE_2    "bm_valvePD_2"
#define BOOKMARK_VALVETEST_DELTAPRESSURE_3    "bm_valvePD_3"
#define BOOKMARK_VALVETEST_DELTAPRESSURE_4    "bm_valvePD_4"

#define BOOKMARK_VALVETEST_THRESHOLD_1    "bm_valvePT_1"
#define BOOKMARK_VALVETEST_THRESHOLD_2    "bm_valvePT_2"
#define BOOKMARK_VALVETEST_THRESHOLD_3    "bm_valvePT_3"
#define BOOKMARK_VALVETEST_THRESHOLD_4    "bm_valvePT_4"

#define BOOKMARK_VALVETEST_RESULT  "bm_valve_result"
#define BOOKMARK_VALVETEST_PASS    "bm_valve_pass"
#define BOOKMARK_VALVETEST_EXCEEDED  "bm_valve_exceeded"

#define BOOKMARK_DATE_YEAR   "bm_year"
#define BOOKMARK_DATE_MONTH  "bm_month"
#define BOOKMARK_DATE_DAY    "bm_day"

#define BOOKMARK_TEST_PICTURE_1         "bm_picAll_1"
#define BOOKMARK_SYSTEST_PICTURE_1      "bm_picSys_1"
#define BOOKMARK_VALVETEST_PICTURE_1    "bm_picValve_1"

#define BOOKMARK_TEST_PICTURE_2         "bm_picAll_2"
#define BOOKMARK_SYSTEST_PICTURE_2      "bm_picSys_2"
#define BOOKMARK_VALVETEST_PICTURE_2    "bm_picValve_2"

#define BOOKMARK_TEST_PICTURE_3         "bm_picAll_3"
#define BOOKMARK_SYSTEST_PICTURE_3      "bm_picSys_3"
#define BOOKMARK_VALVETEST_PICTURE_3    "bm_picValve_3"

#define BOOKMARK_TEST_PICTURE_4         "bm_picAll_4"
#define BOOKMARK_SYSTEST_PICTURE_4      "bm_picSys_4"
#define BOOKMARK_VALVETEST_PICTURE_4    "bm_picValve_4"

#define BOOKMARK_LEAKAGE_COUPLEVALVE    "bm_leakage_couplevalve"
#define BOOKMARK_LEAKAGE_MANHOLECOVER   "bm_leakage_manholecover"
#define BOOKMARK_LEAKAGE_RESULT_0       "bm_leakage_result_0"
#define BOOKMARK_LEAKAGE_RESULT_1       "bm_leakage_result_1"
#define BOOKMARK_LEAKAGE_RESULT_2       "bm_leakage_result_2"

#define BOOKMARK_SELF_YEAR          "bm_year"
#define BOOKMARK_SELF_MONTH         "bm_month"
#define BOOKMARK_SELF_DAY           "bm_day"
#define BOOKMARK_SELF_DEVICEMODEL   "bm_devicemodel"
#define BOOKMARK_SELF_DEVICEID      "bm_deviceid"
#define BOOKMARK_SELF_TESTPIC       "bm_test_pic"
#define BOOKMARK_SELF_BEGIN         "bm_begin"
#define BOOKMARK_SELF_END           "bm_end"
#define BOOKMARK_SELF_THRESHOLD     "bm_threshold"
#define BOOKMARK_SELF_DELTA         "bm_delta"
#define BOOKMARK_SELF_PASS          "bm_self_pass"
#define BOOKMARK_SELF_EXCEEDED      "bm_self_exceeded"

class ReportWoker:public QObject
{
    Q_OBJECT
public:
    ReportWoker();
    ~ReportWoker();

public slots:
    void makeReport(Tanker& tanker, QString& word_path, QString& pic_dir);
    void makeselfReport(DeviceInfo& dev_info, QString& word_path, QString& pic_dir);
    void init();

signals:
    void onProgress(const QString&);
    //void onResult(const int);

private:
    bool make_report(Tanker& tanker, QString word_path, QString pic_dir);
    bool make_selfReport(DeviceInfo& dev_info, QString& word_path, QString& pic_dir);
};

class Report :public QObject
{
    Q_OBJECT
    QThread workerThread;
public:
    Report();
    ~Report();

    void makeReport(Tanker& tanker, QString word_path, QString pic_dir);
    void makeReport_Self(DeviceInfo& dev_info, QString word_path, QString pic_dir);

public slots:
    //void handleResults(const int);
    void recvProgress(const QString& qstr);

signals:
    void operate(Tanker& , QString& , QString& );
    void operateself(DeviceInfo& , QString& , QString& );
    void onProgress(QString);
    void oninit();

};


#endif // REPORT_H
