package com.beecavegames.bjc.handlers;

import org.joda.time.Duration;

import com.beecavegames.Game;
import com.beecavegames.GameDefinition;
import com.beecavegames.GameSession;
import com.beecavegames.Product;
import com.beecavegames.bjc.entities.Player;
import com.beecavegames.dispatch.Param;
import com.beecavegames.social.MoversUtil;
import com.beecavegames.bjc.util.PlayerUtil;
import com.google.inject.Inject;

public class GetMoversHandler<G extends Game> {

	@Inject
	public PlayerUtil playerUtil;
	
	@Inject
	GameDefinition<G> gameDef;
	
	@Inject
	MoversUtil moversUtil;
	
	public MoversResponse handle(Product product, @Param("hours") int hours) {
		Player me = playerUtil.getPlayer(GameSession.getGameSession().beeId); 
		return new MoversResponse(moversUtil.getCached(product, gameDef.getGameType()),
				gameDef.getMoverChips(Duration.standardHours(hours), me));
	}
}
