// Path: core/src/de/golfgl/gdxgamesvcs/achievement/IFetchAchievementsResponseListener.java
// public interface IFetchAchievementsResponseListener {
// 
//     /**
//      * Response with achievement list
//      *
//      * @param achievements null if achievements couldn't be fetched.
//      */
//     void onFetchAchievementsResponse(Array<IAchievement> achievements);
// 
// }
// 
// Path: core/src/de/golfgl/gdxgamesvcs/gamestate/IFetchGameStatesListResponseListener.java
// public interface IFetchGameStatesListResponseListener {
//     /**
//      * Called when game state list was loaded
//      *
//      * @param gameStates null if game states couldn't be fetched.
//      */
//     void onFetchGameStatesListResponse(Array<String> gameStates);
// }
// 
// Path: core/src/de/golfgl/gdxgamesvcs/gamestate/ILoadGameStateResponseListener.java
// public interface ILoadGameStateResponseListener {
//     /**
//      * Returns a game state that was saved in Cloud services
//      *
//      * @param gameState null if loading failed
//      */
//     public void gsGameStateLoaded(byte[] gameState);
// }
// 
// Path: core/src/de/golfgl/gdxgamesvcs/gamestate/ISaveGameStateResponseListener.java
// public interface ISaveGameStateResponseListener {
// 
//     /**
//      * Result of save game request
//      *
//      * @param success   true if game state was sucessfully saved
//      * @param errorCode null if succesful
//      */
//     void onGameStateSaved(boolean success, String errorCode);
// }
// 
// Path: core/src/de/golfgl/gdxgamesvcs/leaderboard/IFetchLeaderBoardEntriesResponseListener.java
// public interface IFetchLeaderBoardEntriesResponseListener {
//     /**
//      * Called when leaderBoard entries are received.
//      *
//      * @param leaderBoard null if leaderBoard couldn't be fetched.
//      */
//     void onLeaderBoardResponse(Array<ILeaderBoardEntry> leaderBoard);
// }


import de.golfgl.gdxgamesvcs.achievement.IFetchAchievementsResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.IFetchGameStatesListResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.ILoadGameStateResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.ISaveGameStateResponseListener;
import de.golfgl.gdxgamesvcs.leaderboard.IFetchLeaderBoardEntriesResponseListener;
package de.golfgl.gdxgamesvcs;


/**
 * This is the main interface for gdx-gamesvcs. Use this in your game core.
 * See the readme file for further information how to use this interface: https://github.com/MrStahlfelge/gdx-gamesvcs
 * <p>
 * Game service client classes implementing this interface are not thread-safe, so you should use references to it
 * either in your UI render thread only or synchronize calls yourself. Using the methods on your render thread is
 * safe and will not block the responsiveness of your game: Blocking calls are done asynchronous.
 * <p>
 * Created by Benjamin Schulte on 16.06.2017.
 */

public interface IGameServiceClient {

    public static final String GS_GAMEJOLT_ID = "GS_GAMEJOLT";
    public static final String GS_GOOGLEPLAYGAMES_ID = "GPGS";
    public static final String GS_AMAZONGC_ID = "GS_AMAZONGC";
    public static final String GS_KONGREGATE_ID = "GS_KONG";
    public static final String GS_GAMECENTER_ID = "GS_APPLE";
    public static final String GS_HUAWEI_ID = "GS_HUAWEI";

    /**
     * Gets an id for this game service for identifiying or showing labels
     *
     * @return Game Service ID
     */
    String getGameServiceId();

    /**
     * Set this listener to get callbacks from the game service client
     * <p>
     * This is not mandatory.
     *
     * @param gsListener your listening class, normally your Main Game class
     */
    void setListener(IGameServiceListener gsListener);

    /**
     * Resumes connection to a user session, if possible
     * <p>
     * It depends from the game service implementation what the session connection state implies. See the
     * documentation of the specific service. This method should be called at application startup, and when resuming
     * in Android. No error messages or log in prompts will be shown in error case.
     * <p>
     * Note: Probably you have set up the GameService client with an initialize() method. It is not defined by
     * this interface because it depends on the service which parameters the method needs.
     *
     * @return true if connection is already established or connection is pending. false if no connect is tried due to
     * unfulfilled prejudices (normally credentials not given).
     * @see #isSessionActive()
     */
    boolean resumeSession();

    /**
     * Opens a user session for the game service if necessary. If possible, user session is resumed silently.
     * <p>
     * This method should only be called when user explicitly pushed a log in button. If supported, log in screens
     * may appear for the user to log in.

     * @return true if connection is already established or connection is pending. false if no connection attempt made.
     * @see #isSessionActive()
     */
    boolean logIn();

    /**
     * Disconnects from Gameservice user session by dropping an open connection or deactivating ping calls,
     * but does not close the user's session and so not invalidating a signin.
     * <p>
     * Use this in your main games pause() method on Android and when game is quit by the user.
     *
     * @see #isSessionActive()
     */
    void pauseSession();

    /**
     * Signs explicitely out and disconnects from Gameservice user session. Use only when explicitely wanted by user to
     * end his session.
     * <p>
     * Notes:
     * Some game services do not provide this feature, the user will stay logged in and connected to a user session.
     * Some game services will allow unauthenticated users to submit events or scores
     */
// Path: core/src/de/golfgl/gdxgamesvcs/achievement/IFetchAchievementsResponseListener.java
// public interface IFetchAchievementsResponseListener {
// 
//     /**
//      * Response with achievement list
//      *
//      * @param achievements null if achievements couldn't be fetched.
//      */
//     void onFetchAchievementsResponse(Array<IAchievement> achievements);
// 
// }
// 
// Path: core/src/de/golfgl/gdxgamesvcs/gamestate/IFetchGameStatesListResponseListener.java
// public interface IFetchGameStatesListResponseListener {
//     /**
//      * Called when game state list was loaded
//      *
//      * @param gameStates null if game states couldn't be fetched.
//      */
//     void onFetchGameStatesListResponse(Array<String> gameStates);
// }
// 
// Path: core/src/de/golfgl/gdxgamesvcs/gamestate/ILoadGameStateResponseListener.java
// public interface ILoadGameStateResponseListener {
//     /**
//      * Returns a game state that was saved in Cloud services
//      *
//      * @param gameState null if loading failed
//      */
//     public void gsGameStateLoaded(byte[] gameState);
// }
// 
// Path: core/src/de/golfgl/gdxgamesvcs/gamestate/ISaveGameStateResponseListener.java
// public interface ISaveGameStateResponseListener {
// 
//     /**
//      * Result of save game request
//      *
//      * @param success   true if game state was sucessfully saved
//      * @param errorCode null if succesful
//      */
//     void onGameStateSaved(boolean success, String errorCode);
// }
// 
// Path: core/src/de/golfgl/gdxgamesvcs/leaderboard/IFetchLeaderBoardEntriesResponseListener.java
// public interface IFetchLeaderBoardEntriesResponseListener {
//     /**
//      * Called when leaderBoard entries are received.
//      *
//      * @param leaderBoard null if leaderBoard couldn't be fetched.
//      */
//     void onLeaderBoardResponse(Array<ILeaderBoardEntry> leaderBoard);
// }


// Path: core/src/de/golfgl/gdxgamesvcs/IGameServiceClient.java
import de.golfgl.gdxgamesvcs.achievement.IFetchAchievementsResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.IFetchGameStatesListResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.ILoadGameStateResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.ISaveGameStateResponseListener;
import de.golfgl.gdxgamesvcs.leaderboard.IFetchLeaderBoardEntriesResponseListener;

package de.golfgl.gdxgamesvcs;


/**
 * This is the main interface for gdx-gamesvcs. Use this in your game core.
 * See the readme file for further information how to use this interface: https://github.com/MrStahlfelge/gdx-gamesvcs
 * <p>
 * Game service client classes implementing this interface are not thread-safe, so you should use references to it
 * either in your UI render thread only or synchronize calls yourself. Using the methods on your render thread is
 * safe and will not block the responsiveness of your game: Blocking calls are done asynchronous.
 * <p>
 * Created by Benjamin Schulte on 16.06.2017.
 */

public interface IGameServiceClient {

    public static final String GS_GAMEJOLT_ID = "GS_GAMEJOLT";
    public static final String GS_GOOGLEPLAYGAMES_ID = "GPGS";
    public static final String GS_AMAZONGC_ID = "GS_AMAZONGC";
    public static final String GS_KONGREGATE_ID = "GS_KONG";
    public static final String GS_GAMECENTER_ID = "GS_APPLE";
    public static final String GS_HUAWEI_ID = "GS_HUAWEI";

    /**
     * Gets an id for this game service for identifiying or showing labels
     *
     * @return Game Service ID
     */
    String getGameServiceId();

    /**
     * Set this listener to get callbacks from the game service client
     * <p>
     * This is not mandatory.
     *
     * @param gsListener your listening class, normally your Main Game class
     */
    void setListener(IGameServiceListener gsListener);

    /**
     * Resumes connection to a user session, if possible
     * <p>
     * It depends from the game service implementation what the session connection state implies. See the
     * documentation of the specific service. This method should be called at application startup, and when resuming
     * in Android. No error messages or log in prompts will be shown in error case.
     * <p>
     * Note: Probably you have set up the GameService client with an initialize() method. It is not defined by
     * this interface because it depends on the service which parameters the method needs.
     *
     * @return true if connection is already established or connection is pending. false if no connect is tried due to
     * unfulfilled prejudices (normally credentials not given).
     * @see #isSessionActive()
     */
    boolean resumeSession();

    /**
     * Opens a user session for the game service if necessary. If possible, user session is resumed silently.
     * <p>
     * This method should only be called when user explicitly pushed a log in button. If supported, log in screens
     * may appear for the user to log in.

     * @return true if connection is already established or connection is pending. false if no connection attempt made.
     * @see #isSessionActive()
     */
    boolean logIn();

    /**
     * Disconnects from Gameservice user session by dropping an open connection or deactivating ping calls,
     * but does not close the user's session and so not invalidating a signin.
     * <p>
     * Use this in your main games pause() method on Android and when game is quit by the user.
     *
     * @see #isSessionActive()
     */
    void pauseSession();

    /**
     * Signs explicitely out and disconnects from Gameservice user session. Use only when explicitely wanted by user to
     * end his session.
     * <p>
     * Notes:
     * Some game services do not provide this feature, the user will stay logged in and connected to a user session.
     * Some game services will allow unauthenticated users to submit events or scores
     */
    void logOff();