package server.utils;

import server.OfferingTile;
import server.Player;
import server.TurnTile;
import server.cards.BuildingCard;
import server.cards.Card;
import server.cards.CharacterCard;
import server.cards.EventCard;

import java.util.Arrays;

public class GameUtils {

    public static String formatCard(Card c) {
        if (c instanceof EventCard e) {
            return "(E "+e.getCardId() + "  " + e.getEvent()+ " Era" +e.getEra()  +")";
        }
        if (c instanceof CharacterCard cc) {
            return "(C "+cc.getCardId() + " " +cc.getCharacterType() + " Era" +cc.getEra()  + ")";
        }
        if (c instanceof BuildingCard b) {
            return "(B "+b.getCardId() + " Era" +b.getEra() + ")";
        }
        return "(#" + c.getCardId() + " UNKNOWN)";
    }

    public static String formatTurnTile(TurnTile t) {
        //for (Player p : t.getPositions()){" : "occupied");
        StringBuilder sb = new StringBuilder();
        sb.append("[TURN ORDER]\n");
        for (int i = 0; i < t.getPositions().length; i++) {
            Player p = t.getPositions()[i];
            sb.append(" ").append(i + 1).append(". ")
                    .append(p.toString()+ "\n");
        }
        return sb.toString();
    }

    public static String formatOffTile(OfferingTile o) {


        return null;
    }


}
