module TD.Data.UpgradedGiftBackdrop
(UpgradedGiftBackdrop(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
data UpgradedGiftBackdrop
= UpgradedGiftBackdrop
{ UpgradedGiftBackdrop -> Maybe Text
name :: Maybe T.Text
, UpgradedGiftBackdrop -> Maybe Int
center_color :: Maybe Int
, UpgradedGiftBackdrop -> Maybe Int
edge_color :: Maybe Int
, UpgradedGiftBackdrop -> Maybe Int
symbol_color :: Maybe Int
, UpgradedGiftBackdrop -> Maybe Int
text_color :: Maybe Int
, UpgradedGiftBackdrop -> Maybe Int
rarity_per_mille :: Maybe Int
}
deriving (UpgradedGiftBackdrop -> UpgradedGiftBackdrop -> Bool
(UpgradedGiftBackdrop -> UpgradedGiftBackdrop -> Bool)
-> (UpgradedGiftBackdrop -> UpgradedGiftBackdrop -> Bool)
-> Eq UpgradedGiftBackdrop
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UpgradedGiftBackdrop -> UpgradedGiftBackdrop -> Bool
== :: UpgradedGiftBackdrop -> UpgradedGiftBackdrop -> Bool
$c/= :: UpgradedGiftBackdrop -> UpgradedGiftBackdrop -> Bool
/= :: UpgradedGiftBackdrop -> UpgradedGiftBackdrop -> Bool
Eq, Int -> UpgradedGiftBackdrop -> ShowS
[UpgradedGiftBackdrop] -> ShowS
UpgradedGiftBackdrop -> String
(Int -> UpgradedGiftBackdrop -> ShowS)
-> (UpgradedGiftBackdrop -> String)
-> ([UpgradedGiftBackdrop] -> ShowS)
-> Show UpgradedGiftBackdrop
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpgradedGiftBackdrop -> ShowS
showsPrec :: Int -> UpgradedGiftBackdrop -> ShowS
$cshow :: UpgradedGiftBackdrop -> String
show :: UpgradedGiftBackdrop -> String
$cshowList :: [UpgradedGiftBackdrop] -> ShowS
showList :: [UpgradedGiftBackdrop] -> ShowS
Show)
instance I.ShortShow UpgradedGiftBackdrop where
shortShow :: UpgradedGiftBackdrop -> String
shortShow UpgradedGiftBackdrop
{ name :: UpgradedGiftBackdrop -> Maybe Text
name = Maybe Text
name_
, center_color :: UpgradedGiftBackdrop -> Maybe Int
center_color = Maybe Int
center_color_
, edge_color :: UpgradedGiftBackdrop -> Maybe Int
edge_color = Maybe Int
edge_color_
, symbol_color :: UpgradedGiftBackdrop -> Maybe Int
symbol_color = Maybe Int
symbol_color_
, text_color :: UpgradedGiftBackdrop -> Maybe Int
text_color = Maybe Int
text_color_
, rarity_per_mille :: UpgradedGiftBackdrop -> Maybe Int
rarity_per_mille = Maybe Int
rarity_per_mille_
}
= String
"UpgradedGiftBackdrop"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
name_
, String
"center_color" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
center_color_
, String
"edge_color" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
edge_color_
, String
"symbol_color" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
symbol_color_
, String
"text_color" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
text_color_
, String
"rarity_per_mille" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
rarity_per_mille_
]
instance AT.FromJSON UpgradedGiftBackdrop where
parseJSON :: Value -> Parser UpgradedGiftBackdrop
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
"upgradedGiftBackdrop" -> Value -> Parser UpgradedGiftBackdrop
parseUpgradedGiftBackdrop Value
v
String
_ -> Parser UpgradedGiftBackdrop
forall a. Monoid a => a
mempty
where
parseUpgradedGiftBackdrop :: A.Value -> AT.Parser UpgradedGiftBackdrop
parseUpgradedGiftBackdrop :: Value -> Parser UpgradedGiftBackdrop
parseUpgradedGiftBackdrop = String
-> (Object -> Parser UpgradedGiftBackdrop)
-> Value
-> Parser UpgradedGiftBackdrop
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"UpgradedGiftBackdrop" ((Object -> Parser UpgradedGiftBackdrop)
-> Value -> Parser UpgradedGiftBackdrop)
-> (Object -> Parser UpgradedGiftBackdrop)
-> Value
-> Parser UpgradedGiftBackdrop
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
name_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"name"
Maybe Int
center_color_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"center_color"
Maybe Int
edge_color_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"edge_color"
Maybe Int
symbol_color_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"symbol_color"
Maybe Int
text_color_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"text_color"
Maybe Int
rarity_per_mille_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"rarity_per_mille"
UpgradedGiftBackdrop -> Parser UpgradedGiftBackdrop
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (UpgradedGiftBackdrop -> Parser UpgradedGiftBackdrop)
-> UpgradedGiftBackdrop -> Parser UpgradedGiftBackdrop
forall a b. (a -> b) -> a -> b
$ UpgradedGiftBackdrop
{ name :: Maybe Text
name = Maybe Text
name_
, center_color :: Maybe Int
center_color = Maybe Int
center_color_
, edge_color :: Maybe Int
edge_color = Maybe Int
edge_color_
, symbol_color :: Maybe Int
symbol_color = Maybe Int
symbol_color_
, text_color :: Maybe Int
text_color = Maybe Int
text_color_
, rarity_per_mille :: Maybe Int
rarity_per_mille = Maybe Int
rarity_per_mille_
}
parseJSON Value
_ = Parser UpgradedGiftBackdrop
forall a. Monoid a => a
mempty