package org.luxons.sevenwonders.game.api;

import org.luxons.sevenwonders.game.boards.Board;
import org.luxons.sevenwonders.game.cards.Card;

public class HandCard {

    private final Card data;

    private final boolean chainable;

    private final boolean free;

    private final boolean playable;

    public HandCard(Card card, Table table, int playerIndex) {
        Board board = table.getBoard(playerIndex);
        this.data = card;
        this.chainable = card.isChainableOn(board);
        this.free = card.isAffordedBy(board) && card.getRequirements().getGold() == 0;
        this.playable = card.isPlayable(table, playerIndex);
    }

    public Card getData() {
        return data;
    }

    public boolean isChainable() {
        return chainable;
    }

    public boolean isFree() {
        return free;
    }

    public boolean isPlayable() {
        return playable;
    }

}

@@ -135,16 +135,221 @@
 .Card;%0A%0A
+/**%0A * A card with contextual information relative to the hand it is sitting in. The extra information is especially%0A * useful because it frees the client from a painful business logic implementation.%0A */%0A
 public c
@@ -388,20 +388,20 @@
 al Card 
-data
+card
 ;%0A%0A    p
@@ -630,20 +630,20 @@
    this.
-data
+card
  = card;
@@ -873,12 +873,12 @@
  get
-Data
+Card
 () %7B
@@ -897,12 +897,12 @@
 urn 
-data
+card
 ;%0A  

Add HandCard doc