module Deck exposing (..) import Card import Json.Decode import Json.Decode.Pipeline as JDP type alias Deck = { id : Int , name : String , cards : List Card } type alias Card = { card : Card.Card , quantity : Int } decode : Json.Decode.Decoder Deck decode = Json.Decode.succeed Deck |> JDP.required "deck_id" Json.Decode.int |> JDP.required "name" Json.Decode.string |> JDP.required "cards" (Json.Decode.list decodeCard) decodeCard : Json.Decode.Decoder Card decodeCard = Json.Decode.succeed Card |> JDP.required "card" Card.decode |> JDP.required "quantity" Json.Decode.int