/*
 * @Description: 
 * @Version: 1.0
 * @Autor: lishengyin
 * @Date: 2022-02-15 15:15:51
 * @LastEditors: lishengyin
 * @LastEditTime: 2022-02-16 09:12:37
 */

#ifndef __PALYRLOGIN_H_
#define __PALYRLOGIN_H_

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

using namespace std;

class PlayerLogin
{
private:
    std::string URL = "/manager.do";
    
public:
    std::string cid;
    std::string ctype;
    std::string cname;
    std::string cpwd;
public:
    PlayerLogin();
    ~PlayerLogin();

    void setURL(std::string url){
        this->URL = url;
    }

    std::string getUrl(){
        return this->URL;
    }

    void objectToJson(std::string& str){
        rapidjson::StringBuffer strBuf;
        rapidjson::Writer<rapidjson::StringBuffer> writer(strBuf);
        this->objectToJson(writer);
        str = strBuf.GetString();
    }

    void objectToJson(rapidjson::Writer<rapidjson::StringBuffer>& writer){
        writer.StartObject();

        writer.Key("cid");
        writer.String(cid.c_str());

        writer.Key("ctype");
        writer.String(ctype.c_str());

        writer.Key("cname");
        
        writer.String(cname.c_str());

        writer.Key("cpwd");
        writer.String(cpwd.c_str());

        writer.EndObject();
    }
};



#endif