module Card exposing (CardData, CardDetails, CardPerformanceData, CardType(..), ManaColor(..), Power(..), pickRate) type ManaColor = Red | Blue | Green | White | Black | Colorless type CardType = Creature | Instant | Sorcery | Enchantment | Artifact | Planeswalker | Land | Other type Power = ConstantPower Int | VariablePower type alias CardData = { details : CardDetails , performance : CardPerformanceData } type alias CardDetails = { cmc : Int , cardType : CardType , typeLine : String , oracleText : String , power : Maybe Power , toughness : Maybe Power , colors : List ManaColor --, manaCost : List ManaColor } type alias CardPerformanceData = { totalTimesSeen : Int , totalTimesPicked : Int , averagePickPosition : Maybe Float , averageSeenPosition : Maybe Float , gameInHandWinRate : Maybe Float } pickRate : CardData -> Float pickRate card = if card.performance.totalTimesSeen == 0 then 0 else toFloat card.performance.totalTimesPicked / toFloat card.performance.totalTimesSeen