package eu.jonahbauer.wizard.common.messages.observer;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import org.jetbrains.annotations.Range;

import java.util.UUID;

/**
 * A {@link PredictionMessage} is sent after a player makes (or changes) his prediction.
 */
@Getter
@EqualsAndHashCode(callSuper = true)
public final class PredictionMessage extends ObserverMessage {
    /**
     * The UUID of the player who made a prediction.
     */
    private final @NonNull UUID player;
    /**
     * The prediction.
     */
    private final @Range(from = 0, to = Integer.MAX_VALUE) int prediction;

    public PredictionMessage(@NonNull UUID player, int prediction) {
        if (prediction < 0) throw new IllegalArgumentException("prediction is out of bounds");
        this.player = player;
        this.prediction = prediction;
    }
}
