This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.

Core.Data.Model

Model menu component

Exported

type alias Model = { name : String , slug : String , leaseDealsAvailable : Bool , stockAvailable : Bool , factoryOrderAvailable : Bool }

A representation of the Model

listDecoder : Decoder (List Model)

Decode the list of Models

decoder : Decoder Model

Model decoder

module Core.Data.Model exposing (Model, listDecoder, decoder)

{-| Model menu component


# Exported

@docs Model, listDecoder, decoder

-}

import Json.Decode exposing (..)
import Json.Decode.Pipeline exposing (decode, required, optional)


{-| A representation of the Model
-}
type alias Model =
    { name : String
    , slug : String
    , leaseDealsAvailable : Bool
    , stockAvailable : Bool
    , factoryOrderAvailable : Bool
    }


{-| Decode the list of Models
-}
listDecoder : Decoder (List Model)
listDecoder =
    list decoder


{-| Model decoder
-}
decoder : Decoder Model
decoder =
    decode Model
        |> required "name" string
        |> required "slug" string
        |> optional "lease_deals_available" bool True
        |> optional "stock_available" bool True
        |> optional "factory_order_available" bool True