package eu.jonahbauer.wizard.client.libgdx.actions.overlay;

import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
import eu.jonahbauer.wizard.client.libgdx.actors.CardActor;
import eu.jonahbauer.wizard.client.libgdx.screens.GameScreen;
import eu.jonahbauer.wizard.common.model.Card;
import org.jetbrains.annotations.NotNull;

public class ChangePredictionOverlay extends MakePredictionOverlay {

    public ChangePredictionOverlay(@NotNull GameScreen gameScreen, long timeout, int round, int oldPrediction) {
        super(
                gameScreen,
                timeout,
                oldPrediction == 0 ? new int[] {oldPrediction + 1}
                        : oldPrediction == round + 1 ? new int[] {oldPrediction - 1}
                        : new int[] {oldPrediction - 1, oldPrediction + 1}
        );
    }

    @Override
    public VerticalGroup createContent() {
        var root = super.createContent();

        var card = new CardActor(Card.CLOUD, atlas);
        root.addActorAt(0, card);
        root.padTop(- CardActor.PREF_HEIGHT);

        return root;
    }
}