#ifndef __GNET_MAPPASSWORDVALUE_RPCDATA
#define __GNET_MAPPASSWORDVALUE_RPCDATA

#include "rpcdefs.h"


namespace GNET
{
	class MapPasswordValue : public GNET::Rpc::Data
	{
	public:
		int userid;
		int algorithm;
		Octets password;
		Octets matrix;
		Octets seed;
		Octets pin;
		int rtime;
		int refreshtime;

	public:
		MapPasswordValue (int l_userid = 0,int l_algorithm = 0,const Octets& l_password = Octets()
			,const Octets& l_matrix = Octets(),const Octets& l_seed = Octets(),const Octets& l_pin = Octets()
			,int l_rtime = 0,int l_refreshtime = 0)
			: userid(l_userid),algorithm(l_algorithm),password(l_password)
			,matrix(l_matrix),seed(l_seed),pin(l_pin)
			,rtime(l_rtime),refreshtime(l_refreshtime)
		{
		}

		MapPasswordValue(const MapPasswordValue &rhs)
			: userid(rhs.userid),algorithm(rhs.algorithm),password(rhs.password),
			matrix(rhs.matrix),seed(rhs.seed),pin(rhs.pin),
			rtime(rhs.rtime),refreshtime(rhs.refreshtime) { }

		Rpc::Data *Clone() const { return new MapPasswordValue(*this); }

		Rpc::Data& operator = (const Rpc::Data &rhs)
		{
			const MapPasswordValue *r = dynamic_cast<const MapPasswordValue *>(&rhs);
			if (r && r != this)
			{
				userid = r->userid;
				algorithm = r->algorithm;
				password = r->password;
				matrix = r->matrix;
				seed = r->seed;
				pin = r->pin;
				rtime = r->rtime;
				refreshtime = r->refreshtime;
			}
			return *this;
		}

		MapPasswordValue& operator = (const MapPasswordValue &rhs)
		{
			const MapPasswordValue *r = &rhs;
			if (r && r != this)
			{
				userid = r->userid;
				algorithm = r->algorithm;
				password = r->password;
				matrix = r->matrix;
				seed = r->seed;
				pin = r->pin;
				rtime = r->rtime;
				refreshtime = r->refreshtime;
			}
			return *this;
		}

		OctetsStream& marshal(OctetsStream & os) const
		{
			os << userid;
			os << algorithm;
			os << password;
			os << matrix;
			os << seed;
			os << pin;
			os << rtime;
			os << refreshtime;
			return os;
		}

		const OctetsStream& unmarshal(const OctetsStream &os)
		{
			os >> userid;
			os >> algorithm;
			os >> password;
			os >> matrix;
			os >> seed;
			os >> pin;
			os >> rtime;
			os >> refreshtime;
			return os;
		}

	};
};
#endif
