//////////////////////////////////////////////////////////////////////////////
//
// Asura_Rewards_System.h
//
// Copyright (c) 2009 Rebellion. All rights reserved.
//
// Description:
//
//     Engine class to unify platform Reward (achievement) systems
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef ASURA_REWARDS_SYSTEM_H___
#define ASURA_REWARDS_SYSTEM_H___ 1

#ifdef ASURA_USE_REWARDS

class Asura_Rewards_System
{
public:
	static void Initialise();	//Called once on Startup to trigger any allocations needed, and start and platform specific init work (enumerating achievements, installing trophy pack)

	static void Shutdown();	//Called once on quitting application - deallocate as needed, and shutdown any platform specific stuff

	static void HandleEvent(Asura_Hash_ID uEventHash, int iEventData = 0);	//Event handler wrapper function - this is the main entry point for other code, indicate which event has occured by a hash of it's name, and takes an optional int of data.

	static void Reset();	//Reset and stored data about current progress - this is mainly to be called when current user changes, for platforms where that is meaningful.

	static bool IsRewardUnlocked(u_int uRewardIndex)	//Checks if a reward is unlocked, using a project specific, platform independent list of rewards.
	{
		return Platform_IsRewardUnlocked(uRewardIndex);
	}

	static bool IsRewardAvailable(u_int uRewardIndex)	//Checks if a reward is valid for the current platform.
	{
		return Platform_IsRewardAvailable(uRewardIndex);
	}

	static bool IsInitComplete()	//checks if Initialisation is complete - what this implies is somewhat platform specific, but in game reward displays would need this to be true as an example
	{
		return Platform_IsInitComplete();
	}

	static bool IsReadyToUnlock()	//is platform code ready for Platform_UnlockReward to be called
	{
		return Platform_IsReadyToUnlock();
	}

private:
	static void Platform_Initialise();

	static void Platform_Shutdown();

	static void Platform_Reset();

	static void Project_HandleEvent(Asura_Hash_ID uEventHash, int iEventData);	//Main project event handler. Ideally, code for multi platform rewards would go here to prevent duplication.

	static void Project_Platform_HandleEvent(Asura_Hash_ID uEventHash, int iEventData);	//Platform specific event handler - events can have handler code in both functions. Intended for code for platform specific awards, or independent rewards that need platform specific code.

	static void Platform_UnlockReward(u_int uRewardIndex);	//This will convert the independent reward into it's platform identifier, and if possible unlock it

	static void Platform_RewardProgress(u_int uRewardIndex, u_int uProgress, u_int uTarget);	//This will convert the independent reward into it's platform identifier, and if possible report the progress to the user
																								//uProgress is what the user has achieved so far, uTarget is the number they need to get the reward

	static bool Platform_IsRewardUnlocked(u_int uRewardIndex);

	static bool Platform_IsRewardAvailable(u_int uRewardIndex);

	static bool Platform_IsInitComplete();

	static bool Platform_IsReadyToUnlock();
};

#endif // #ifdef ASURA_USE_REWARDS

// E N D   F I L E   W R A P P E R ///////////////////////////////////////////

#endif // #ifndef ASURA_REWARDS_SYSTEM_H___
