package it.polimi.ingsw.gc14.Model;
import java.io.Serializable;


/**
 * Abstract base class for all playable cards.
 * A PlayableCard is characterized by an era value.
 */
public abstract class PlayableCard implements Serializable {

    /**
     * The era associated with this playable card.
     */
    private int Era;

    /**
     * Returns the era of this playable card.
     *
     * @return the era of this playable card.
     */
    public int getEra(){
        return Era;
    }

    /**
     * Creates a playable card with the specified era.
     *
     * @param Era the era of the playable card.
     * @throws IllegalArgumentException if {@code Era <= 0} or {@code Era >= 4}.
     */
    public PlayableCard (int Era) throws IllegalArgumentException{
        if (Era>0 && Era<4) {
            this.Era = Era;
        } else {
            throw new IllegalArgumentException();
        }
    }

    /**
     * Returns the string representation of this playable card.
     *
     * @return the string representation of this playable card.
     */
    @Override
    public String toString() {
        return "Era:"+String.valueOf(Era);
    }
}
