package cards.maumau.model;

public class WaitForNextTurnState implements PlayerState {
    private final PlayerHandler handler;

    public WaitForNextTurnState(PlayerHandler handler) {
        this.handler = handler;
    }

    @Override
    public void nextTurn(int n) {
        // Logic for next turn
        if (handler.getCurrentPlayer().getCards().isEmpty()) {
            handler.setRemember(handler.getCurrentPlayer());
            handler.localNextTurn(n);
            handler.setCurrentState(handler.getWaitForMauMauState());
        } else if (handler.getCurrentPlayer().getCards().size() == 1) {
            handler.setRemember(handler.getCurrentPlayer());
            handler.localNextTurn(n);
            handler.setCurrentState(handler.getWaitForMauState());
        } else {
            handler.localNextTurn(n);
            handler.setCurrentState(handler.getWaitForNextTurnState());
        }
    }

    @Override
    public void mau(Player p) {
        // Do nothing or handle invalid state transition
    }

    @Override
    public void maumau(Player p) {
        // Do nothing or handle invalid state transition
    }
}
