package de.tud.kom.socom.database.game;
import java.sql.SQLException;
import java.util.List;
import de.tud.kom.socom.components.game.Game;
import de.tud.kom.socom.components.game.GameContext;
import de.tud.kom.socom.components.game.GameInstance;
import de.tud.kom.socom.util.exceptions.ContextNotFoundException;
import de.tud.kom.socom.util.exceptions.CouldNotDeleteContextException;
import de.tud.kom.socom.util.exceptions.CouldNotDeleteGameException;
import de.tud.kom.socom.util.exceptions.CouldNotDeleteGameInstanceException;
import de.tud.kom.socom.util.exceptions.GameAlreadyExistException;
import de.tud.kom.socom.util.exceptions.GameContextAlreadyExistException;
import de.tud.kom.socom.util.exceptions.GameContextRelationAlreadyExistException;
import de.tud.kom.socom.util.exceptions.GameInstanceNotFoundException;
import de.tud.kom.socom.util.exceptions.GameNotAuthenticatedException;
import de.tud.kom.socom.util.exceptions.GameVersionAlreadyExistException;
import de.tud.kom.socom.util.exceptions.NoSNConnectionException;
import de.tud.kom.socom.util.exceptions.SocialNetworkUnsupportedException;
/**
*
* @author rhaban
*
*/
public interface GameDatabase {
public void addGame(Game game) throws SQLException, GameAlreadyExistException;
public void addInstance(long gameid, GameInstance gameinstance) throws SQLException, GameVersionAlreadyExistException;
public Game getGame(long gameId) throws SQLException;
public void removeInstance(long gameInstanceId) throws SQLException, CouldNotDeleteGameInstanceException;
public void removeGame(String game) throws SQLException, CouldNotDeleteGameException;
public void addContext(long gameInstId, String extContextId, String name) throws SQLException, GameContextAlreadyExistException;
public String autogenerateContext(long gameInstId, String name) throws SQLException, GameContextAlreadyExistException;
public void addContextRelation(long gameInstId, String parent, String child, boolean autogenerated) throws SQLException, ContextNotFoundException,
GameContextRelationAlreadyExistException;
public void addContextRelation(long gameInstId, long parentId, long childId, boolean autogenerated) throws GameContextRelationAlreadyExistException, SQLException;
public List<GameContext> getGameContexts(long gameInstId) throws SQLException;
public List<GameContext> getGameContextRelations(long gameInstId) throws SQLException;
public GameContext getGameContextRelations(long gameInstId, String contextid) throws SQLException;
public boolean removeContextRelation(long gameInstId, String parent, String child) throws SQLException, ContextNotFoundException;
public void removeContext(long gameInstId, String context) throws SQLException, ContextNotFoundException, CouldNotDeleteContextException;
public long getGameInstance(String gamename, String gameversion) throws SQLException, GameInstanceNotFoundException;
public long getGameContextId(String externalid, long gameInstance) throws SQLException, ContextNotFoundException;
public GameContext getGameContext(long gameinstid, String contextId) throws SQLException, ContextNotFoundException;
public long authenticateGame(String game, String password) throws SQLException, GameNotAuthenticatedException;
public long authenticateGameInstance(String game, String version, String gamepassword) throws SQLException, GameNotAuthenticatedException,
GameInstanceNotFoundException;
public long authenticateGameInstance(long gameinstid, String gamepassword) throws SQLException, GameNotAuthenticatedException,
GameInstanceNotFoundException;
public boolean setInstanceImage(long instanceid, String imageFile) throws SQLException;
public boolean setContextImage(long instanceid, String contextid, String imageFile) throws SQLException;
public boolean setInstanceDescription(long gameInstance, String description) throws SQLException;
public boolean setContextDescription(long gameinstanceid, String contextid, String string) throws SQLException;
boolean addSNApp(String network, long gameId, long appId, String appSecret, boolean autofillRedirects,
String token_redirect, String general_redirect) throws SQLException, GameAlreadyExistException;
public long getSNAppId(String socialnetwork, long gameinstid) throws SQLException, NoSNConnectionException;
public String getSNTokenRedirectUrl(String socialnetwork, long gameinstid) throws SQLException, NoSNConnectionException;
public String getSNAppSecret(String socialnetwork, long gameinstid) throws SQLException, NoSNConnectionException;
public String getGameIdentifier(long gameinstid) throws SQLException;
public boolean connectSocialNetworkPage(long uid, long gameinstanceid, String network, String pageidentifier, String token) throws SQLException;
public String getSocialNetworkPageId(String network, long uid, long gameinstid) throws SQLException, SocialNetworkUnsupportedException;
public String getGameIdentString(long gameinstid) throws SQLException;
public String getSocialNetworkPageToken(String string, long uid, long gameinstid) throws SQLException, SocialNetworkUnsupportedException;
}