# Class CardFactory

java.lang.Object
it.polimi.ingsw.is25am31.model.cards.CardFactory

public class CardFactory extends Object
`CardFactory` is responsible for managing and handling a collection of cards used in the game. It reads card data from a predefined JSON file and provides functionality to retrieve specific cards based on certain criteria, including randomness and test flight availability.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CardFactory()`
  Reads the JSON file with cards info, puts it into a stream and then creates a list of all the Cards

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Card`
  `getRandomCard(int level)`
  `List<Card>`
  `getTestFlightCards()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CardFactory

    public CardFactory()
    Reads the JSON file with cards info, puts it into a stream and then creates a list of all the Cards

- ## Method Details

  - ### getRandomCard

    public Card getRandomCard(int level)
    Parameters:
      `level` - Level of the required card.
    Returns:
      Random card of a specified level that hasn't already been returned.

  - ### getTestFlightCards

    public List<Card> getTestFlightCards()
    Returns:
      All 8 test flight cards.