package eu.jonahbauer.wizard.core.model.card;

import eu.jonahbauer.wizard.common.model.Card;
import eu.jonahbauer.wizard.common.util.Pair;
import lombok.Getter;

import java.util.List;
import java.util.UUID;

@Getter
public class ColoredSubcard extends ColoredCard implements Subcard {
    private final GameCard parent;

    public ColoredSubcard(Card card, GameCard parent, double value, Card.Suit suit) {
        super(card, value, suit);
        this.parent = parent;
    }

    @Override
    public void play(UUID player, List<Card> hand, List<Pair<UUID, Card>> stack) {
        parent.checkHand(hand);
        hand.remove(parent.getCard());
        stack.add(Pair.of(player, getCard()));
    }

    @Override
    public boolean isPlayable(List<Card> hand, List<Pair<UUID, Card>> stack) {
        return hand.contains(parent.getCard());
    }
}
