/*
 * @Description: 
 * @Version: 1.0
 * @Autor: lishengyin
 * @Date: 2022-02-28 15:13:15
 * @LastEditors: lishengyin
 * @LastEditTime: 2022-02-28 15:40:58
 */

#ifndef ___NETTYEXPELDEVINFO_H_
#define ___NETTYEXPELDEVINFO_H_

#include <iostream>
using namespace std;

#include <rapidjson/document.h>
#include <rapidjson/rapidjson.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>

class NettyExpelDevInfo
{
public:
    std::string addTime;
    int appId;
    int areaDetailId;
    int areaId;
    std::string attr1;
    std::string attr2;
    std::string attr3;
    int batteryStatus;
    std::string birdDeviceCode;
    std::string coX;
    std::string coY;
    std::string coZ;
    int createBy;
    int deviceControlType;
    std::string deviceDataAttr1;
    std::string deviceDataAttr2;
    std::string deviceDataAttr3;
    std::string deviceMac;
    std::string deviceName;
    std::string deviceNum;
    std::string devicePassWord;
    int deviceSource;
    int deviceSubType;
    int deviceType;
    std::string deviceUserName;
    std::string deviceUuid;
    int dvId;
    int enableFlag;
    int gasPressure;
    std::string groupAreaName;
    std::string groupField;
    std::string imgUrl;
    std::string latitude;
    std::string linkDvId;
    std::string localIp;
    std::string longitude;
    std::string name;
    int num;
    int oxyPressure;
    int parentDvId;
    std::string parentDvName;
    std::string place;
    int port;
    int powerStatus;
    std::string remark;
    int status;
    std::string stream;
    int subCol;
    std::string subName;
    int subRow;
    int updateBy;
    std::string updateTime;
    int uploadId;
    int workStatus;

public:
    NettyExpelDevInfo(){}
    ~NettyExpelDevInfo(){}

    /**
     * @description: json反序列为对象
     * @param {*}
     * @return {*}
     */    
    bool jsonToObject(const rapidjson::Value& object){
        const auto end = object.MemberEnd();
        if(end == object.FindMember("birdDeviceCode") || !object["birdDeviceCode"].IsString()){
            return false;
        }else{
            birdDeviceCode = object["birdDeviceCode"].GetString();
        }
        if(end == object.FindMember("deviceControlType") || !object["deviceControlType"].IsInt()){
            return false;
        }else{
            deviceControlType = object["deviceControlType"].GetInt();
        }
        if(end == object.FindMember("deviceType") || !object["deviceType"].IsInt()){
            return false;
        }else{
            deviceType = object["deviceType"].GetInt();
        }
        return true;
    }
};




#endif