package com.vogella.jersey.first.response;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.mongodb.MongoClient;
import com.vogella.jersey.first.model.Account;
import com.vogella.jersey.first.model.AccountInfo;
import com.vogella.jersey.first.model.ChatMessage;
import com.vogella.jersey.first.model.MoveGameCharacterInfo;
import com.vogella.jersey.first.response.content.AccountInfoContent;
import com.vogella.jersey.first.response.content.MoveGameCharacterInfoContent;
import com.vogella.jersey.first.response.content.OkResponseContent;
import com.vogella.jersey.first.response.content.ResponseContent;
import com.vogella.jersey.first.response.result.ResponseResult;
import com.vogella.jersey.first.util.GameMongoDBUtils;
import com.vogella.jersey.first.model.GCharMoveResult;
import com.vogella.jersey.first.model.mapobject.Coin;
import com.vogella.jersey.first.model.mapobject.GameCharacter;
import com.vogella.jersey.first.model.mapobject.Portal;

public class ResponseManager{

	private static ResponseManager instance;

	public static void init(){
		if(instance == null){
			instance = new ResponseManager();
		}
	}

	public static ResponseManager getInstance(){
		init();
		return instance;
	}

	public static void dispose(){
		instance.disposeResources();
	}

	private void disposeResources(){
		gameMongoDBUtils.close();
	}

	private GameMongoDBUtils gameMongoDBUtils;

	private ResponseManager(){
		this.gameMongoDBUtils = new GameMongoDBUtils();
	}

	private Response getResponse(AccountInfo accountInfo){
		Response response = new Response();
		if(accountInfo != null){
			response.responseResult = ResponseResult.ok();
			response.responseContent = new AccountInfoContent(accountInfo);
		}else{
			response.responseResult = ResponseResult.error();
			response.responseContent = null;
		}
		return response;
	}

	private Response getResponse(MoveGameCharacterInfo moveGameCharacterInfo){
		Response response = new Response();
		if(moveGameCharacterInfo != null){
			response.responseResult = ResponseResult.ok();
			response.responseContent = new MoveGameCharacterInfoContent(moveGameCharacterInfo);
		}else{
			response.responseResult = ResponseResult.error();
			response.responseContent = null;
		}
		return response;
	}

	private Response getResponse(boolean correct){
		Response response = new Response();
		if(correct){
			response.responseResult = ResponseResult.ok();
			response.responseContent = new OkResponseContent("OK");
		}else{
			response.responseResult = ResponseResult.error();
			response.responseContent = null;
		}
		return response;
	}

	public synchronized Response getLoginResponse(String id,String password){
		AccountInfo accountInfo = gameMongoDBUtils.login(id,password);
		return getResponse(accountInfo);
	}

	public synchronized Response getLogoutResponse(String token,String id,String password){
		AccountInfo accountInfo = gameMongoDBUtils.logout(token,id,password);
		return getResponse(accountInfo);
	}

	public synchronized Response getAccountInfoResponse(String token,String id,String password){
		AccountInfo accountInfo = gameMongoDBUtils.getAccountInfo(token,id,password);
		return getResponse(accountInfo);
	}

	public synchronized Response getRegisterResponse(String id,String password,String email){
		AccountInfo accountInfo = gameMongoDBUtils.register(id,password,email);
		return getResponse(accountInfo);
	}

	public synchronized Response getSelectGameCharacterResponse(String token,String id,String password,int selection){
		AccountInfo accountInfo = gameMongoDBUtils.selectGameCharacter(token,id,password,selection);
		return getResponse(accountInfo);
	}

	public synchronized Response getUpdateEmailResponse(String token,String id,String password,String newEmail){
		AccountInfo accountInfo = gameMongoDBUtils.updateEmail(token,id,password,newEmail);
		return getResponse(accountInfo);
	}

	public synchronized Response getAddGameCharacterResponse(String token,String id,String password,int accountSlot,int gameCharacterTeam,int gameCharacterClass,String gameCharacterName,double gameCharacterLatitude,double gameCharacterLongitude,double gameCharacterMetersSee,double gameCharacterMetersTouch){
		AccountInfo accountInfo = gameMongoDBUtils.addGameCharacter(token,id,password,accountSlot,gameCharacterTeam,gameCharacterClass,gameCharacterName,gameCharacterLatitude,gameCharacterLongitude,gameCharacterMetersSee,gameCharacterMetersTouch);
		return getResponse(accountInfo);
	}

	public synchronized Response getDeleteGameCharacterResponse(String token,String id,String password,int accountSlot){
		AccountInfo accountInfo = gameMongoDBUtils.deleteGameCharacter(token,id,password,accountSlot);
		return getResponse(accountInfo);
	}

	public synchronized Response getMoveGameCharacterResponse(String token,String id,String password,double latitude,double longitude){
		MoveGameCharacterInfo moveGameCharacterInfo = gameMongoDBUtils.moveGameCharacter(token,id,password,latitude,longitude);
		return getResponse(moveGameCharacterInfo);
	}

	public synchronized Response getProjectileResponse(String token,String id,String password,double angle,int type){
		boolean throwedCorrect = gameMongoDBUtils.throwProjectile(token,id,password,angle,type);
		return getResponse(throwedCorrect);
	}

	public Response deleteAll(){
		gameMongoDBUtils.dropbDB();
		return null;
	}

	public Response addStuffMap(){
		gameMongoDBUtils.addStuffMap();
		return null;
	}

	public Response addChatMessageResponse(String token,String id,String password,String message,int type){
		ChatMessage chatMessage = new ChatMessage();
		chatMessage.gameCharacterId = AAAAAAAAA;
		chatMessage.gameCharacterName = AAAAAAAAA;
		chatMessage.id = AAAAAAAAA;
		chatMessage.message = message;
		chatMessage.time = ""+System.currentTimeMillis();
		chatMessage.type = type;
		gameMongoDBUtils.chatManager.insert(chatMessage)
	}

	/*
	 * public static Response getLoginResponse(String user, String password) {
	 * GameMongoDBUtils gameMongoDBUtils = new GameMongoDBUtils(); Account
	 * account = gameMongoDBUtils.login(user, password);
	 * gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if
	 * (!gameMongoDBUtils.isEmptyNull(account.token)) { response.responseResult
	 * = ResponseResult.ok(); response.responseContent = new
	 * LoginContent(account); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response getLogoutResponse(String token, String user,
	 * String password) { GameMongoDBUtils gameMongoDBUtils = new
	 * GameMongoDBUtils(); boolean success = gameMongoDBUtils.logout(token,
	 * user, password); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (success) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new LogoutContent(user); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response getAccount(String user) { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); Account account =
	 * gameMongoDBUtils.getAccount(user); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (account != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new AccountContent(account); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response getAccount(String token, String user, String
	 * password) { GameMongoDBUtils gameMongoDBUtils = new GameMongoDBUtils();
	 * Account account = gameMongoDBUtils.getAccount(token, user, password);
	 * gameMongoDBUtils.close(); System.out.println("account:" + account);
	 * 
	 * Response response = new Response(); if (account != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new AccountContent(account); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response getAccounts() { GameMongoDBUtils gameMongoDBUtils
	 * = new GameMongoDBUtils(); List<Account> accounts =
	 * gameMongoDBUtils.getAccounts(); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (accounts != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new AccountsContent(accounts); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response register(String user, String password, String
	 * email) { GameMongoDBUtils gameMongoDBUtils = new GameMongoDBUtils();
	 * Account registeredAccount = gameMongoDBUtils.register(user, password,
	 * email); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (registeredAccount != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new RegisterContent(user, password, email); } else {
	 * response.responseResult = ResponseResult.error();
	 * response.responseContent = null; } return response; }
	 * 
	 * public static Response addCharacter(String token, String user, String
	 * password, int accountSlot, int gameCharacterTeam, int gameCharacterClass,
	 * String gameCharacterName, double gameCharacterLatitude, double
	 * gameCharacterLongitude , double gameCharacterMetersSee , double
	 * gameCharacterMetersTouch) { GameMongoDBUtils gameMongoDBUtils = new
	 * GameMongoDBUtils(); GameCharacter gameCharacter =
	 * gameMongoDBUtils.addGameCharacter(token, user, password, accountSlot,
	 * gameCharacterTeam, gameCharacterClass, gameCharacterName,
	 * gameCharacterLatitude, gameCharacterLongitude, gameCharacterMetersSee,
	 * gameCharacterMetersTouch); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (gameCharacter != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new AddGameCharacterContent( gameCharacter); } else {
	 * response.responseResult = ResponseResult.error();
	 * response.responseContent = null; } return response; }
	 * 
	 * public static Response getGameCharacter(String user, int
	 * gameCharacterSlot) { GameMongoDBUtils gameMongoDBUtils = new
	 * GameMongoDBUtils(); GameCharacter gameCharacter =
	 * gameMongoDBUtils.getGameCharacter(user, gameCharacterSlot);
	 * gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (gameCharacter != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new GameCharacterContent(gameCharacter); } else { response.responseResult
	 * = ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response getGameCharacter(String characterId) {
	 * GameMongoDBUtils gameMongoDBUtils = new GameMongoDBUtils(); GameCharacter
	 * gameCharacter = gameMongoDBUtils .getGameCharacter(characterId);
	 * gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (gameCharacter != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new GameCharacterContent(gameCharacter); } else { response.responseResult
	 * = ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response getGameCharacters(String user) { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); List<GameCharacter>
	 * gameCharacters = new ArrayList<>();
	 * gameCharacters.addAll(gameMongoDBUtils.getGameCharacters(user));
	 * gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (gameCharacters != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new GameCharactersContent(gameCharacters); } else {
	 * response.responseResult = ResponseResult.error();
	 * response.responseContent = null; } return response; }
	 * 
	 * public static Response getGameCharacters() { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); List<GameCharacter>
	 * gameCharacters = gameMongoDBUtils .getGameCharacters();
	 * gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (gameCharacters != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new GameCharactersContent(gameCharacters); } else {
	 * response.responseResult = ResponseResult.error();
	 * response.responseContent = null; } return response; }
	 * 
	 * public static Response updateGameCharacterName(String token, String user,
	 * String password, String characterId, String name) { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); GameCharacter gameCharacter =
	 * gameMongoDBUtils.updateGameCharacterName( token, user, password,
	 * characterId, name); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (gameCharacter != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new GameCharacterContent(gameCharacter); } else { response.responseResult
	 * = ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response updateGameCharacterMoney(String token, String
	 * user, String password, String characterId, long money) { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); GameCharacter gameCharacter =
	 * gameMongoDBUtils .updateGameCharacterMoney(token, user, password,
	 * characterId, money); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (gameCharacter != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new GameCharacterContent(gameCharacter); } else { response.responseResult
	 * = ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response updateGameCharacterExpLevel(String token, String
	 * user, String password, String characterId, long level) { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); GameCharacter gameCharacter =
	 * gameMongoDBUtils .updateGameCharacterExpLevel(token, user, password,
	 * characterId, level); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (gameCharacter != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new GameCharacterContent(gameCharacter); } else { response.responseResult
	 * = ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response deleteCharacter(String token, String user, String
	 * password, int characterSlot) { GameMongoDBUtils gameMongoDBUtils = new
	 * GameMongoDBUtils(); boolean deleted =
	 * gameMongoDBUtils.deleteGameCharacter(token, user, password,
	 * characterSlot); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (deleted) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new DeleteContent(deleted); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response deleteCharacter(String token, String user, String
	 * password, String characterId) { GameMongoDBUtils gameMongoDBUtils = new
	 * GameMongoDBUtils(); boolean deleted =
	 * gameMongoDBUtils.deleteGameCharacter(token, user, password, characterId);
	 * gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (deleted) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new DeleteContent(deleted); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response addCoin(double latitude, double longitude, int
	 * value) { GameMongoDBUtils gameMongoDBUtils = new GameMongoDBUtils(); Coin
	 * coin = gameMongoDBUtils.addCoinOrCoinValue(latitude, longitude, value);
	 * gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (coin != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new MessageContent(coin.toString()); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response deleteCoin(String coinId) { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); String coinIdDeleted =
	 * gameMongoDBUtils.deleteCoin(coinId); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if
	 * (!gameMongoDBUtils.isEmptyNull(coinIdDeleted)) { response.responseResult
	 * = ResponseResult.ok(); response.responseContent = new
	 * MessageContent(coinIdDeleted); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response deleteCoinAll() { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); boolean deleted =
	 * gameMongoDBUtils.deleteAllCoins(); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (deleted) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new MessageContent("" + deleted); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response getCoins() { GameMongoDBUtils gameMongoDBUtils =
	 * new GameMongoDBUtils(); List<Coin> coins = gameMongoDBUtils.getCoins();
	 * gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (coins != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new MessageContent("" + Arrays.toString(coins.toArray()));
	 * System.out.println("coins.size() " + coins.size()); } else {
	 * response.responseResult = ResponseResult.error();
	 * response.responseContent = null; } return response; }
	 * 
	 * public static Response getPortals() { GameMongoDBUtils gameMongoDBUtils =
	 * new GameMongoDBUtils(); List<Portal> portals =
	 * gameMongoDBUtils.getPortals(); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (portals != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new MessageContent("" + Arrays.toString(portals.toArray()));
	 * System.out.println("portals.size() " + portals.size()); } else {
	 * response.responseResult = ResponseResult.error();
	 * response.responseContent = null; } return response; }
	 * 
	 * public static Response getCoinsSize() { GameMongoDBUtils gameMongoDBUtils
	 * = new GameMongoDBUtils(); long numCoins =
	 * gameMongoDBUtils.getCoinsSize(); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (numCoins > -1) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new MessageContent("" + numCoins); System.out.println("numCoins " +
	 * numCoins); } else { response.responseResult = ResponseResult.error();
	 * response.responseContent = null; } return response; }
	 * 
	 * public static Response getPortalsSize() { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); long numPortals =
	 * gameMongoDBUtils.getPortalsSize(); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (numPortals > -1) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new MessageContent("" + numPortals); System.out.println("numPortals " +
	 * numPortals); } else { response.responseResult = ResponseResult.error();
	 * response.responseContent = null; } return response; }
	 * 
	 * public static Response updateCoin(String coinId, double latitude, double
	 * longitude, int value) { GameMongoDBUtils gameMongoDBUtils = new
	 * GameMongoDBUtils(); Coin coin = gameMongoDBUtils.updateCoin(coinId,
	 * latitude, longitude, value); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (coin != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new MessageContent(coin.toString()); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response updateEmail(String token, String user, String
	 * password, String email) { GameMongoDBUtils gameMongoDBUtils = new
	 * GameMongoDBUtils(); Account account = gameMongoDBUtils.updateEmail(token,
	 * user, password, email); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (account != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new EmailContent(account); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response selectGameCharacter(String token, String user,
	 * String password, String gameCharacterId) { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); Account account =
	 * gameMongoDBUtils.selectGameCharacter(token, user, password,
	 * gameCharacterId); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (account != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new AccountContent(account); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response movedGameCharacter(String token, String user,
	 * String password, double latitude, double longitude) { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); Object[] data =
	 * gameMongoDBUtils.movedGameCharacter(token, user, password, latitude,
	 * longitude); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (data != null && data[0] != null
	 * && data[1] != null) { response.responseResult = ResponseResult.ok();
	 * response.responseContent = new MapDataContent( (GameCharacter) data[0],
	 * (GCharMoveResult) data[1]); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response addPortal(double latitude, double longitude, int
	 * teamOwner, double progressCaptured) { GameMongoDBUtils gameMongoDBUtils =
	 * new GameMongoDBUtils(); Portal portal =
	 * gameMongoDBUtils.addPortal(latitude, longitude, teamOwner,
	 * progressCaptured); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (portal != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new MessageContent("portal:" + portal); } else { response.responseResult
	 * = ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response deleteAllPortals() { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); boolean deleted =
	 * gameMongoDBUtils.deleteAllPortals(); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (deleted) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new MessageContent("" + deleted); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response deletePortal(String id) { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); String idDeleted =
	 * gameMongoDBUtils.deletePortal(id); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if
	 * (!gameMongoDBUtils.isEmptyNull(idDeleted)) { response.responseResult =
	 * ResponseResult.ok(); response.responseContent = new
	 * MessageContent(idDeleted); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response getChatMessages(String token, String user, String
	 * password, int chatType) { GameMongoDBUtils gameMongoDBUtils = new
	 * GameMongoDBUtils(); List<ChatMessage> chatMessages =
	 * gameMongoDBUtils.getChatMessages( token, user, password, chatType);
	 * gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (chatMessages != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new ChatMessagesContent(chatMessages); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 * 
	 * public static Response addChatMessage(String token, String user, String
	 * password, int chatType, String message) { GameMongoDBUtils
	 * gameMongoDBUtils = new GameMongoDBUtils(); ChatMessage chatMessage =
	 * gameMongoDBUtils.addChatMessage(token, user, password, chatType,
	 * message); gameMongoDBUtils.close();
	 * 
	 * Response response = new Response(); if (chatMessage != null) {
	 * response.responseResult = ResponseResult.ok(); response.responseContent =
	 * new ChatMessageContent(chatMessage); } else { response.responseResult =
	 * ResponseResult.error(); response.responseContent = null; } return
	 * response; }
	 */
}
