#ifndef PREDEFINE_H
#define PREDEFINE_H

#include <QDebug>
#include <QThread>

#define KEY_SIZE					24
#define MAX_RSA_KEY_LEN				2048
#define MAX_BUF_LEN					25600
#define MAX_JSON_KEY_LEN			128
#define MAX_SIGN_LEN				256

#define DEFAULT_CONNECTNAME         "posinfo"
#define DEFAULT_DBNAME              "order.db"
#define DEFAULT_DBFORM              "orderlist"

//#define SHA256RSA_PRIVATEKEY        "MIICeQIBADANBgkqhkiG9w0BAQEFAASCAmMwggJfAgEAAoGBAKbFeAqipCea1OXTR6wmz2D7XKUJ6ffRl/VRgF23kbxhhUseJ1jWJW9n7bJ1DyJsMzNgLzpi5jwCasZlvMAS+TdRYQtlvdHV8EDH8JKVaCn1O+emoN/Tbp+ngZLkZNqu3bWTQ6fBgbun4gyeFC1cXb87kn0dnBdkjnGZ/MuDu9oPAgMBAAECgYEAip3t1iEzgnvOY60GkM+9ZWXoroEcCNEcllqE8OCo8MS6LyLEH7H3ca8XwlJMHxeCQzy6ZLRZnB2CNJ/RkHD01S12JH3NPoeuY04/zhpl1BRq5Zm9iuIMkg5LP1cNjRnB5v8/ENZdLTXYEcrz4d3UDXZXvD2ywqoNNGqMqqp/U1ECQQDma32C2t3LV3lS9QeLejGXwDTeksJ53NzsUoGUOIQNkIC7f66tQfYG6wVWBfGoZTpxcLWweC+jPQ+75knWdmLHAkEAuUkYGKtzIeNmKJ0siew/dY31+Rb/pVHYj7TnZDx3dIYly0mwigQGCU7uVzkADXqyEqU+AQWU+RagQWwmjlWGeQJBALdYiMJ6zUlkDVIJTzuYu6V4d5kzRjQZnmEdNaZvYgQ5G3YWnzOV7OKMV+6fRC8ufVaOzMPinmVRzRdCozZXdTkCQQCapPo6pOasMyqx3TUuTINOr1TMOLjYl65Diz7Rt3IQTGLBAFkbaG5NWJavMADuPyjfTRGqMql7GLpawFSR2aopAkEAmKme0TgKB4EpdxS7xV4/XEm+MuZXE/dAfnN5fNOVueWw+23gDYvLXZAoAZNdpdaWw/CZl66XL6M1RMiDYllNvw=="
//#define DEFAULT_ACCESS_TOKEN        "3e0e8e1b-ad85-4ec0-a0ec-ad92bb5ae043"

//正式环境
#define SHA256RSA_PRIVATEKEY         "MIICeQIBADANBgkqhkiG9w0BAQEFAASCAmMwggJfAgEAAoGBAKbFeAqipCea1OXTR6wmz2D7XKUJ6ffRl/VRgF23kbxhhUseJ1jWJW9n7bJ1DyJsMzNgLzpi5jwCasZlvMAS+TdRYQtlvdHV8EDH8JKVaCn1O+emoN/Tbp+ngZLkZNqu3bWTQ6fBgbun4gyeFC1cXb87kn0dnBdkjnGZ/MuDu9oPAgMBAAECgYEAip3t1iEzgnvOY60GkM+9ZWXoroEcCNEcllqE8OCo8MS6LyLEH7H3ca8XwlJMHxeCQzy6ZLRZnB2CNJ/RkHD01S12JH3NPoeuY04/zhpl1BRq5Zm9iuIMkg5LP1cNjRnB5v8/ENZdLTXYEcrz4d3UDXZXvD2ywqoNNGqMqqp/U1ECQQDma32C2t3LV3lS9QeLejGXwDTeksJ53NzsUoGUOIQNkIC7f66tQfYG6wVWBfGoZTpxcLWweC+jPQ+75knWdmLHAkEAuUkYGKtzIeNmKJ0siew/dY31+Rb/pVHYj7TnZDx3dIYly0mwigQGCU7uVzkADXqyEqU+AQWU+RagQWwmjlWGeQJBALdYiMJ6zUlkDVIJTzuYu6V4d5kzRjQZnmEdNaZvYgQ5G3YWnzOV7OKMV+6fRC8ufVaOzMPinmVRzRdCozZXdTkCQQCapPo6pOasMyqx3TUuTINOr1TMOLjYl65Diz7Rt3IQTGLBAFkbaG5NWJavMADuPyjfTRGqMql7GLpawFSR2aopAkEAmKme0TgKB4EpdxS7xV4/XEm+MuZXE/dAfnN5fNOVueWw+23gDYvLXZAoAZNdpdaWw/CZl66XL6M1RMiDYllNvw=="
#define DEFAULT_ACCESS_TOKEN         "5c1bf782-a117-4aed-8ddc-66a415820d34"


#define TIMEOUT_TRY_LOGING          20000
#define TIMEOUT_TRY_PULLORDER       60000
#define TIMEOUT_TOKEN_LOGIN         7*24*60*60*1000

#define TCP_JSON_KEY_STATUS     "status"

#define APP_THEME               "deaufult"
#define APP_VERSION             "1.20160923.01"     //TODO

#define SERVER_PASSWORD         "posoperator@freemud.cn"

#define CONFIG_NAME             "config.ini"
#define STOREINFO_NAME          "store.ini"
#define USERCONFIG_NAME         "userConfig.ini"
#define PREINTER_CONSS          "printer.ini"
#define PREINTER_NEED           "needprt.ini"

#define UI_CASHIER              "<font color='#ff0000'>未选择</font>"
#define UI_STOREID              "<font color='#ff0000'>未登录</font>"

#define INI_HOST                "SqlServer/host"
#define INI_USERNAME            "SqlServer/username"
//#define INI_PASSWORD            "SqlServer/password"
#define INI_DATABASE            "SqlServer/database"
#define INI_SERVER              "FmServer/url"
#define INI_PRINTERNAME         "Printer/name"
#define INI_FLOATPOSTION        "Float/postion"
#define INI_FLOATOPACITY        "Float/opacity"
#define INI_BLINKINTERVAL       "Float/blinkInterval"
#define INI_SOUNDINTERVAL       "Float/soundInterval"
#define INI_REENTRY             "Features/reEntry"
#define INI_TCPPORT             "TcpServer/Port"
#define INI_DBSERVERIP          "DbServer/ip"
#define INI_DBSERVERPORT        "DbServer/port"
#define INI_STOREID             "info/storeId"
#define INI_POSNO               "info/posNo"
#define INI_PASSWORD            "info/password"
#define INI_AUTOCONFIRM         "info/autoconfirm"
#define INI_UIVISIBLE           "Ui/visible"

#define INI_DELEORDERTIMER      "all/dltordertimer"

#define INI_NEEDPTR             "all/needotherprt"
#define INI_NEEDLABEL           "all/needlabel"

#define INI_PUSHSERVER          "info/pushserver"
#define INI_GETSERVER           "info/getserver"

#define INI_BASE_STOREID        "base/storeid"
#define INI_BASE_PARNETID       "base/parnetid"
#define INI_BASE_USERID         "base/userid"
#define INI_BASE_PWD            "base/pwd"
#define INI_BASE_STATIONIID     "base/stationid"

#define JSON_REQTYPE            "reqtype"
#define JSON_CURRENTUSER        "current_user"
#define JSON_USERNAME           "username"
#define JSON_PASSWORD           "password"
#define JSON_STORENAME          "store_name"
#define JSON_STATIONID          "station_id"
#define JSON_OPERATORID         "operator_id"
#define JSON_STATUSCODE         "statusCode"
#define JSON_STATUS             "status"
#define JSON_STATUSDESC         "status_desc"
#define JSON_MESSAGE            "msg"
#define JSON_DAILYSUMMARYS      "daily_summarys"
#define JSON_TIMESTAMPS         "timestamp"
#define JSON_KEY_PRICE          "price"
#define JSON_AUTOCONFIRM        "autoconfirm"
#define JSON_TOKEN              "token"
#define JSON_POSVERSION         "pos_version"
#define JSON_ORDERS             "orders"
#define JSON_PRODUCTS           "products"
#define JSON_KEY_DISCOUNTS      "discounts"
#define JSON_KEY_DELIVERTIME    "delivery_time"
#define JSON_ORDERID            "order_id"
#define JSON_REASON             "reason"
#define JSON_REASONCODE         "reason_code"
#define JSON_SYNCTIME           "sync_time"
#define JSON_STOREID            "store_id"
#define JSON_DEVICEID           "device_id"
#define JSON_CHANNEL            "channel"
#define JSON_TOTALNUM           "total_number"
#define JSON_TOTALFEE           "total_fee"
#define JSON_REFUNDTOTALNUM     "refund_number"
#define JSON_REFUNDTOTALFEE     "refund_total_fee"
#define JSON_DELIVERS           "deliverymans"
#define JSON_DELIVERYID         "deliveryman_id"
#define JSON_DELIVERYNAME       "deliveryman_name"
#define JSON_DELIVERYPHONE      "deliveryman_phone"
#define JSON_ORDER              "order"
#define JSON_SHOPSTATUS         "channels"
#define JSON_SHOPSTATUSDESC     "status_desc"
#define JSON_BUSINESSDATE       "business_date"
#define JSON_BILLFEE            "bill_fee"
#define JSON_BILLSTATUS         "bill_status"
#define JSON_BILLTYPE           "bill_type"
#define JSON_SUCCESSNUM         "success_number"
#define JSON_FAILEDNUM          "fail_number"
#define JSON_SUCCESSSUM         "success_total_fee"
#define JSON_FAILEDSUM          "fail_total_fee"
//#define JSON_KEY_UNIFY_ID       "unify_id"

#define DB_KEY_ORDERID              "order_id"
#define DB_KEY_ORDETRCAHNGETIME     "order_change_time"
#define DB_KEY_ORDERWRITETIMR       "order_write_status"
#define DB_KEY_ORDERREFUNDSATUS     "order_refund_status"
#define DB_KEY_ORDERPRINTFSTATUS    "order_print_status"
#define DB_KEY_RESERVED1            "reserved1"
#define DB_KEY_RESERVED2            "reserved2"
#define DB_KEY_RESERVED3            "reserved3"
#define DB_KEY_RESERVED4            "reserved4"
#define DB_KEY_RESERVED5            "reserved5"

#define JSON_KEY_VERSION            "ver"
#define JSON_KEY_PARTNERID          "partner_id"

#define JSON_KEY_PUSH_PARTNERID     "partnerId"
#define JSON_KEY_PUSH_STOREID       "storeId"
#define JSON_KEY_PUSH_PROTOCPL      "protocol"
#define JSON_KEY_PUSH_PORT          "port"
#define JSON_KEY_PUSH_HOST          "host"
#define JSON_KEY_PUSH_URL           "url"

#define LOGIN_STORE_NAME            "store_name"
#define LOGIN_STORE_PHONE           "phone"
#define LOGIN_RESULT                "result"

#define JSON_KEY_USERID             "user_id"
#define JSON_KEY_PWD                "pwd"
#define JSON_KEY_TIMESTAMP          "timestamp"
#define JSON_KEY_AUTOCONFIRM        "autoconfirm"

#define JSON_KEY_APPVER             "app_ver"
#define JSON_KEY_SYSTEMVER          "system_ver"
#define JSON_KEY_DEVICENAME         "device_name"

#define JSON_KEY_ACTION             "action"
#define JSON_KEY_ACCESS_TOKEN       "access_token"
#define JSON_KEY_VER                "ver"
#define JSON_KEY_CODE               "code"
#define JSON_KEY_MESSAGE            "message"
#define JSON_KEY_RESULT             "result"
#define JSON_KEY_SYNCTIME           "sync_time"
#define JSON_KEY_ORDERS             "orders"
#define JSON_KEY_PICKORDERLIST      "to_processAdvance_orderVOS"
#define JSON_KEY_DATA               "data"
#define JSON_KEY_UNIFYID            "unify_id"
#define JSON_KEY_TOKEN              "token"
#define JSON_KEY_REASON             "reason"

#define JSON_KEY_PIVKUP_ORDERID     "order_id"
#define JSON_KEY_PIVKUP_OPT         "type"

#define JSON_KEY_LISTDATA           "listData"
#define JSON_KEY_STOREUNIFYID       "store_unify_id"

#define JSON_KEY_ORDERID            "order_id"
#define JSON_KEY_REASONCODE         "reason_code"
#define JSON_KEY_REASON             "reason"
#define JSON_KEY_ORDERSTATUS        "status"
#define JSON_KEY_REFUNDSTATUS       "refund_status"

#define EVENT_KEY_STATUS            "status"
#define EVENT_KEY_MSG               "msg"

#define EVENT_KEY_ORDERID            "order_id"
#define EVENT_KEY_SEASIONCODE        "reason_code"
#define EVENT_KEY_SEASION            "reason"
#define EVENT_KEY_ORDERSTATUS        "orderstatus"

#define JSON_KEY_PUORDERID           "order_id"
#define JSON_KEY_PUTYPE              "type"

#define EVENT_KEY_NETWORKSTATUS      "networkstatus"

#define TCPJSON_KEY_STOREID     "storeId"
#define TCPJSON_KEY_TOKEN       "token"

//// 订单的操作码
#define OPERATION_GETDELIVERS   "getDelivers"
#define OPERATION_CONFRIM       "confirm"
#define OPERATION_REFUSE        "refuse"
#define OPERATION_MAKEOVER      "makeover"
#define OPERATION_SENDOUT       "sendOut"
#define OPERATION_COMPLETE      "complete"
#define OPERATION_REFUND        "refund"
#define OPERATION_REFUSEREFUND  "refuseRefund"
#define OPERATION_REFUNDORDER   "refundOrder"
// 订单操作名
#define OPERATIONNAME_GETDELIVERS   "接单"
#define OPERATIONNAME_REFUSE        "拒单"
#define OPERATIONNAME_MAKEOVER      "制作完成"
#define OPERATIONNAME_SENDOUT       "送出"
#define OPERATIONNAME_COMPLETE      "完成"
#define OPERATIONNAME_REFUSEREFUND  "拒绝"
#define OPERATIONNAME_REFUNDORDER   "退单"
#define OPERATIONNAME_AGREE         "同意"
#define OPERATIONNAME_REFUNDNEWORDER "拒绝接单"

#define REJECTUITYPE_REFUSEREFUND     0
#define REJECTUITYPE_AGREEREFUND      1
#define REJECTUITYPE_REFUSEORDER      2
#define REJECTUITYPE_CANCLEORDER      3

// 属性名称
#define PROPERTY_ID             "id"            // 人员编号
#define PROPERTY_NAME           "name"          // 人员姓名
#define PROPERTY_PHONE          "phone"         // 人员电话
#define PROPERTY_SHIFTID        "shiftId"       // 班次编号
#define PROPERTY_SHIFTNAME      "shiftName"     // 班次名称

#define DEFAULT_LOCATION_PRINT  512
#define DEFAULT_LOCATION_write  513
#define DEFAULT_LOCATION_refund  514

//汇报类型
#define REFUNDREPORT            1
#define ENTRYREPORT             0

//订单保存时间
#define ORDER_SAVE_DATE         (24*60*60)
#define DEFALUE_CHECK_TIME      (10*60*1000)
//缺省值
#define DEFAULT_APP_VER         "1.0"
#define DEFAULT_SYSTEM_VER      "1.0"
//登陆超时
#define JSON_LOGIN_TIMEOUT      60000
// 服务器返回正确值
#define JSON_STATUSCODE_OK      100
// 默认拉取订单的间隔时间
#define VALUE_PULLSYNCTIME      180000
// 默认网络超时时间
#define VALUE_NETTIMEOUT        10000
// 默认重新尝试登录的时间
#define VALUE_RELOGINTIME       20000
// 新订单提示音音频时长
#define VALUE_NEWORDERTIME      3000        //TODO
// 需退款提示音音频时长
#define VALUE_REFUNDORDERTIME   3000        //TODO
// 拒绝退款理由
#define VALUE_REFUSEREFUND_REASON  "拒绝退款"
//
#define FILE_PRINT_TEMPLET                  "printtemplet.txt"
#define FILE_PRINTTAKE_TEMPLET              "printtemplettake.txt"
#define FILE_PRINT80_TEMPLET                "printtemplet80.txt"
#define FILE_PRINTTAKE80_TEMPLET            "printtemplettake80.txt"
#define FILE_PRINTYY_TEMPLET                "printtempletyy.txt"
#define FILE_PRINTYY80_TEMPLET              "printtempletyy80.txt"
#define FILE_PRINTO2O_TEMPLET               "printtempleto2o.txt"
#define FILE_PRINTO2O80_TEMPLET             "printtempleto2o80.txt"
#define FILE_PRINTO2OZZ_TEMPLET             "printtempleto2ozz.txt"
#define FILE_PRINTO2OZZ80_TEMPLET           "printtempleto2ozz80.txt"


#define DEFAULT_PRINTF_MAIN_SESSION         "Printer"
#define DEFAULT_PRINTF_OTHER_SESSION        "OtherPrinter"

#define DEFAULT_SESSION_COMDEF              "COMDEF"
#define DEFAULT_SESSION_OTHERCOMDEF         "OTHERCOMDEF"

#endif // PREDEFINE_H
