package cards.maumau.model;

import cards.Card;
import cards.Rank;
import cards.Suit;

public class Normal implements HandlerState {
    private final ActionHandler handler;

    Normal(ActionHandler handler) {
        this.handler = handler;
    }

    public void addPlayer(Player player){}
    public void startGame(){}
    public void finishGame(){
        handler.setGameState(GameState.GAME_OVER);
        handler.setHandlerState(new Finished(handler));
    }
    public void cancelGame(){}

    public void chooseCard(Card c){
        if (handler.canPlay(c)) {
            handler.getGame().getPlayerHandler().getCurrentPlayer().playCard(c);
            if (c.rank() == Rank.SEVEN) {
                handler.increment7Counter();
                handler.getGame().getPlayerHandler().nextTurn(1);
                handler.setHandlerState(new SevenChosen(handler));
            } else if (c.rank() == Rank.JACK) {
                handler.setGameState(GameState.CHOOSE_SUIT);
                handler.setHandlerState(new JackChosen(handler));
            } else if (c.rank() == Rank.EIGHT) {
                handler.getGame().getPlayerHandler().nextTurn(2);
            } else {
                handler.getGame().getPlayerHandler().nextTurn(1);
            }
        }
    }

    public void chooseSuit(Suit suit){}
    public void skip(){
        handler.getGame().getPlayerHandler().getCurrentPlayer().drawCards(1);
        handler.getGame().getPlayerHandler().nextTurn(1);
    }
    public void no7(){}
}
