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

// PURPOSE:

#ifndef LEADERBOARD_QUERIES_H
#define LEADERBOARD_QUERIES_H

#include "LeaderboardEntry.h"

#include <bdLobby/bdLobbyCommon/bdCustomQueryParams.h>
#include <bdLobby/bdStats/bdStatsQueryResult.h>

#define MAX_HIGHEST_KILL_RATE_RESULTS (25u)

#define	HIGHEST_KILL_RATE_QUERY_ID (0u)
#define MAX_READ_STATS_BY_RANGE_RESULTS (25u)

class HighestKillRateQuery : public bdCustomQueryParams
{
	public:

		BD_DECLARE_NEW_AND_DELETE_OPERATORS

		HighestKillRateQuery(const bdUInt maxNumResults);

		virtual ~HighestKillRateQuery();
		
		virtual void serialize(bdBitBuffer &buffer);

};

template <bdUInt N>
class LeaderboardQueryResult : public bdStatsQueryResult
{
	public:

		BD_DECLARE_NEW_AND_DELETE_OPERATORS

		LeaderboardQueryResult();

		virtual ~LeaderboardQueryResult();

		virtual bdBool handleResult(const bdUInt numResults,
									bdBitBufferRef buffer);	

		bdUInt getResults(LeaderboardEntry* results,
						  const bdUInt numResults);

		LeaderboardEntry& operator[] (const bdUInt i);

	protected:

		LeaderboardEntry m_results[N];
};

typedef LeaderboardQueryResult<1> ReadStatsByIDResult;
typedef LeaderboardQueryResult<MAX_READ_STATS_BY_RANGE_RESULTS> ReadStatsByRangeResult;
typedef LeaderboardQueryResult<MAX_HIGHEST_KILL_RATE_RESULTS> HighestKillRateResult;

#include "LeaderboardQueryResults.inl"

#endif // LEADERBOARD_QUERIES_H
