#ifndef __GNET_GTERRITORYDETAIL_RPCDATA
#define __GNET_GTERRITORYDETAIL_RPCDATA

#include "rpcdefs.h"


namespace GNET
{
	class GTerritoryDetail : public GNET::Rpc::Data
	{
	public:
		short id;
		short level;
		unsigned int owner;
		int occupy_time;
		unsigned int challenger;
		unsigned int deposit;
		int cutoff_time;
		int battle_time;
		int bonus_time;
		int color;
		int status;
		int timeout;
		int maxbonus;
		int challenge_time;
		Octets challengerdetails;
		char reserved1;
		char reserved2;
		char reserved3;

	public:
		GTerritoryDetail (short l_id = 0,short l_level = 0,unsigned int l_owner = 0
			,int l_occupy_time = 0,unsigned int l_challenger = 0,unsigned int l_deposit = 0
			,int l_cutoff_time = 0,int l_battle_time = 0,int l_bonus_time = 0
			,int l_color = 0,int l_status = 0,int l_timeout = 0
			,int l_maxbonus = 0,int l_challenge_time = 0,Octets l_challengerdetails = 0
			,char l_reserved1 = 0,char l_reserved2 = 0,char l_reserved3 = 0)
			: id(l_id),level(l_level),owner(l_owner)
			,occupy_time(l_occupy_time),challenger(l_challenger),deposit(l_deposit)
			,cutoff_time(l_cutoff_time),battle_time(l_battle_time),bonus_time(l_bonus_time)
			,color(l_color),status(l_status),timeout(l_timeout)
			,maxbonus(l_maxbonus),challenge_time(l_challenge_time),challengerdetails(l_challengerdetails)
			,reserved1(l_reserved1),reserved2(l_reserved2),reserved3(l_reserved3)
		{
		}

		GTerritoryDetail(const GTerritoryDetail &rhs)
			: id(rhs.id),level(rhs.level),owner(rhs.owner),
			occupy_time(rhs.occupy_time),challenger(rhs.challenger),deposit(rhs.deposit),
			cutoff_time(rhs.cutoff_time),battle_time(rhs.battle_time),bonus_time(rhs.bonus_time),
			color(rhs.color),status(rhs.status),timeout(rhs.timeout),
			maxbonus(rhs.maxbonus),challenge_time(rhs.challenge_time),challengerdetails(rhs.challengerdetails),
			reserved1(rhs.reserved1),reserved2(rhs.reserved2),reserved3(rhs.reserved3) { }

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

		Rpc::Data& operator = (const Rpc::Data &rhs)
		{
			const GTerritoryDetail *r = dynamic_cast<const GTerritoryDetail *>(&rhs);
			if (r && r != this)
			{
				id = r->id;
				level = r->level;
				owner = r->owner;
				occupy_time = r->occupy_time;
				challenger = r->challenger;
				deposit = r->deposit;
				cutoff_time = r->cutoff_time;
				battle_time = r->battle_time;
				bonus_time = r->bonus_time;
				color = r->color;
				status = r->status;
				timeout = r->timeout;
				maxbonus = r->maxbonus;
				challenge_time = r->challenge_time;
				challengerdetails = r->challengerdetails;
				reserved1 = r->reserved1;
				reserved2 = r->reserved2;
				reserved3 = r->reserved3;
			}
			return *this;
		}

		GTerritoryDetail& operator = (const GTerritoryDetail &rhs)
		{
			const GTerritoryDetail *r = &rhs;
			if (r && r != this)
			{
				id = r->id;
				level = r->level;
				owner = r->owner;
				occupy_time = r->occupy_time;
				challenger = r->challenger;
				deposit = r->deposit;
				cutoff_time = r->cutoff_time;
				battle_time = r->battle_time;
				bonus_time = r->bonus_time;
				color = r->color;
				status = r->status;
				timeout = r->timeout;
				maxbonus = r->maxbonus;
				challenge_time = r->challenge_time;
				challengerdetails = r->challengerdetails;
				reserved1 = r->reserved1;
				reserved2 = r->reserved2;
				reserved3 = r->reserved3;
			}
			return *this;
		}

		OctetsStream& marshal(OctetsStream & os) const
		{
			os << id;
			os << level;
			os << owner;
			os << occupy_time;
			os << challenger;
			os << deposit;
			os << cutoff_time;
			os << battle_time;
			os << bonus_time;
			os << color;
			os << status;
			os << timeout;
			os << maxbonus;
			os << challenge_time;
			os << challengerdetails;
			os << reserved1;
			os << reserved2;
			os << reserved3;
			return os;
		}

		const OctetsStream& unmarshal(const OctetsStream &os)
		{
			os >> id;
			os >> level;
			os >> owner;
			os >> occupy_time;
			os >> challenger;
			os >> deposit;
			os >> cutoff_time;
			os >> battle_time;
			os >> bonus_time;
			os >> color;
			os >> status;
			os >> timeout;
			os >> maxbonus;
			os >> challenge_time;
			os >> challengerdetails;
			os >> reserved1;
			os >> reserved2;
			os >> reserved3;
			return os;
		}

	};
};
#endif
