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

import eu.jonahbauer.wizard.common.model.Card;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.jetbrains.annotations.Nullable;

/**
 * A {@link TrumpMessage} is sent when the trump suit of the current round is (being) determined.
 */
@Getter
@EqualsAndHashCode(callSuper = true)
public final class TrumpMessage extends ObserverMessage {
    /**
     * The {@link Card} that was revealed to determine the {@linkplain Card.Suit trump suit} or {@code null} no cards
     * were left.
     */
    private final @Nullable Card card;
    /**
     * The trump suit or {@code null} is the dealer has yet to decide.
     */
    private final @Nullable Card.Suit suit;

    public TrumpMessage(@Nullable Card card, @Nullable Card.Suit suit) {
        if (card == null && suit == null) throw new IllegalArgumentException("Card and suit must not both be null");

        this.card = card;
        this.suit = suit;
    }
}
