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

// PURPOSE:	

#ifndef BD_ARCHIVE_KEY_H
#define BD_ARCHIVE_KEY_H

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

#define BD_MAX_KEY_NAME_LEN 255

class bdArchiveKeyHash;

/// Contains a single 'key' for a keyPair.
/// The key is made up of:
/// m_entityID (usersID/teamID)
/// m_keyName
class bdArchiveKey
{
	public:	

		bdArchiveKey();

		bdArchiveKey(const bdEntityID entityID, 
					 const bdBool isTeam,
					 const bdString keyName);

		/// Equality operator.
		/// Compare this to other.
		/// \param other[in]	The address to compare to.
		/// \return 
		///  - True if equal.
		///  - False otherwise.
		bdBool operator==(const bdArchiveKey &other) const;
		
		void set(const bdEntityID entityID, 
				 const bdBool isTeam,
				 const bdString keyName);

		bdEntityID getEntityID() const;

		bdBool getIsTeam() const;

		bdString getKeyName() const;

		void serialize(bdBitBufferRef buffer) const;

		bdBool deserialize(bdBitBufferRef buffer);

		friend class bdArchiveKeyHash;

	protected:

		bdEntityID m_entityID;
		bdBool m_isTeam;
		bdString m_keyName;
};

class bdArchiveKeyHash
{
	public:

		bdUInt getHash(const bdArchiveKey &key) const;
};

#endif //BD_ARCHIVE_KEY_H
