module TD.Data.UpgradedGiftSymbolCount
(UpgradedGiftSymbolCount(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.UpgradedGiftSymbol as UpgradedGiftSymbol
data UpgradedGiftSymbolCount
= UpgradedGiftSymbolCount
{ UpgradedGiftSymbolCount -> Maybe UpgradedGiftSymbol
symbol :: Maybe UpgradedGiftSymbol.UpgradedGiftSymbol
, UpgradedGiftSymbolCount -> Maybe Int
total_count :: Maybe Int
}
deriving (UpgradedGiftSymbolCount -> UpgradedGiftSymbolCount -> Bool
(UpgradedGiftSymbolCount -> UpgradedGiftSymbolCount -> Bool)
-> (UpgradedGiftSymbolCount -> UpgradedGiftSymbolCount -> Bool)
-> Eq UpgradedGiftSymbolCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UpgradedGiftSymbolCount -> UpgradedGiftSymbolCount -> Bool
== :: UpgradedGiftSymbolCount -> UpgradedGiftSymbolCount -> Bool
$c/= :: UpgradedGiftSymbolCount -> UpgradedGiftSymbolCount -> Bool
/= :: UpgradedGiftSymbolCount -> UpgradedGiftSymbolCount -> Bool
Eq, Int -> UpgradedGiftSymbolCount -> ShowS
[UpgradedGiftSymbolCount] -> ShowS
UpgradedGiftSymbolCount -> String
(Int -> UpgradedGiftSymbolCount -> ShowS)
-> (UpgradedGiftSymbolCount -> String)
-> ([UpgradedGiftSymbolCount] -> ShowS)
-> Show UpgradedGiftSymbolCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpgradedGiftSymbolCount -> ShowS
showsPrec :: Int -> UpgradedGiftSymbolCount -> ShowS
$cshow :: UpgradedGiftSymbolCount -> String
show :: UpgradedGiftSymbolCount -> String
$cshowList :: [UpgradedGiftSymbolCount] -> ShowS
showList :: [UpgradedGiftSymbolCount] -> ShowS
Show)
instance I.ShortShow UpgradedGiftSymbolCount where
shortShow :: UpgradedGiftSymbolCount -> String
shortShow UpgradedGiftSymbolCount
{ symbol :: UpgradedGiftSymbolCount -> Maybe UpgradedGiftSymbol
symbol = Maybe UpgradedGiftSymbol
symbol_
, total_count :: UpgradedGiftSymbolCount -> Maybe Int
total_count = Maybe Int
total_count_
}
= String
"UpgradedGiftSymbolCount"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"symbol" String -> Maybe UpgradedGiftSymbol -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe UpgradedGiftSymbol
symbol_
, String
"total_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
total_count_
]
instance AT.FromJSON UpgradedGiftSymbolCount where
parseJSON :: Value -> Parser UpgradedGiftSymbolCount
parseJSON v :: Value
v@(AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"upgradedGiftSymbolCount" -> Value -> Parser UpgradedGiftSymbolCount
parseUpgradedGiftSymbolCount Value
v
String
_ -> Parser UpgradedGiftSymbolCount
forall a. Monoid a => a
mempty
where
parseUpgradedGiftSymbolCount :: A.Value -> AT.Parser UpgradedGiftSymbolCount
parseUpgradedGiftSymbolCount :: Value -> Parser UpgradedGiftSymbolCount
parseUpgradedGiftSymbolCount = String
-> (Object -> Parser UpgradedGiftSymbolCount)
-> Value
-> Parser UpgradedGiftSymbolCount
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"UpgradedGiftSymbolCount" ((Object -> Parser UpgradedGiftSymbolCount)
-> Value -> Parser UpgradedGiftSymbolCount)
-> (Object -> Parser UpgradedGiftSymbolCount)
-> Value
-> Parser UpgradedGiftSymbolCount
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe UpgradedGiftSymbol
symbol_ <- Object
o Object -> Key -> Parser (Maybe UpgradedGiftSymbol)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"symbol"
Maybe Int
total_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"total_count"
UpgradedGiftSymbolCount -> Parser UpgradedGiftSymbolCount
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (UpgradedGiftSymbolCount -> Parser UpgradedGiftSymbolCount)
-> UpgradedGiftSymbolCount -> Parser UpgradedGiftSymbolCount
forall a b. (a -> b) -> a -> b
$ UpgradedGiftSymbolCount
{ symbol :: Maybe UpgradedGiftSymbol
symbol = Maybe UpgradedGiftSymbol
symbol_
, total_count :: Maybe Int
total_count = Maybe Int
total_count_
}
parseJSON Value
_ = Parser UpgradedGiftSymbolCount
forall a. Monoid a => a
mempty