package eu.jonahbauer.wizard.client.libgdx.state;

import eu.jonahbauer.wizard.client.libgdx.Client;
import eu.jonahbauer.wizard.common.messages.server.ServerMessage;
import lombok.SneakyThrows;

import java.util.Optional;

public abstract class Awaiting extends BaseState implements ClientState {
    @Override
    public Optional<ClientState> onMessage(Client client, ServerMessage message) {
        return unexpectedMessage(client, message);
    }
    
    @Override
    @SneakyThrows
    public Optional<ClientState> onEnter(Client client) {
        client.timeout(this, 10_000);
        return Optional.empty();
    }
    
    @Override
    public Optional<ClientState> onTimeout(Client client) {
        System.out.println("Timed out. Returning to menu");
        return Optional.of(new Menu());
    }
    
}