#pragma once

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

using namespace std;


class RecLoginMsg
{
public:
    std::string code = "0";
    std::string msg = "HeartBeat";
    

public:
    RecLoginMsg(){}
    ~RecLoginMsg(){}

    /**
     * @description: json转换为object
     * @param {*}
     * @return {*}
     */    
    bool jsonToObject(const rapidjson::Value& object){
        const auto end = object.MemberEnd();

        if(end == object.FindMember("code") || !object["code"].IsString()){
            return false;
        }
        else{
            code = object["code"].GetString();
        }
        if(end == object.FindMember("msg") || !object["msg"].IsString()){
            return false;
        }
        else{
            msg = object["msg"].GetString();
        }
        return true;
    }
    
};