// DWBS ------------------------------------------------------------------ DWBS
//
// PLATFORM		: ALL
// PRODUCT		: BIT_DEMON
// VISIBILITY	: PUBLIC
//
// DWBS ------------------------------------------------------------------ DWBS

// PURPOSE:	

#ifndef BD_KEY_PAIR_DICT_H
#define BD_KEY_PAIR_DICT_H

#include <bdCore/bdCore.h>
#include <bdLobby/bdLobbyCommon/bdLobbyServicesCommon.h>
#include <bdLobby/bdLobbyCommon/bdQueryResult.h>

#include <bdLobby/bdKeyArchive/bdArchiveKey.h>
#include <bdLobby/bdKeyArchive/bdArchiveValue.h>

/// This class contains the multiple bdKeyPairs (bdArchiveKey->bdArchiveValue) which will be written to the bdKeyArchive 
/// on the server.
class bdKeyPairDict : public bdQueryResult, public bdHashMap<bdArchiveKey, bdArchiveValue, bdArchiveKeyHash>
{
	public:
		
		BD_DECLARE_NEW_AND_DELETE_OPERATORS

		bdKeyPairDict();
		~bdKeyPairDict();

		void serialize(bdBitBufferRef buffer,
					   const bdBool isReadKeyPairs) const;

		bdBool deserialize(const bdUInt numResults, 
						   bdBitBufferRef buffer);
		
		/// Handles a result set for a title specific query.
		/// \param numResults[in] : The number of rows in the result set.
		/// \param values[in] : The actual values of each data field.
		virtual bdBool handleResult(const bdUInt /*numEntityIDs*/, 
									bdBitBufferRef buffer);

	protected:

		
};

class bdEntityIDKey
{
public:
	bdEntityID entityID;
	bdBool isTeam;
	bdBool operator==(const bdEntityIDKey &other) const
	{
		return (entityID == other.entityID) &&
			   (isTeam == other.isTeam);
	};
};

#endif //BD_KEY_PAIR_DICT_H
