module TD.Data.BusinessFeaturePromotionAnimation
(BusinessFeaturePromotionAnimation(..)) 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.BusinessFeature as BusinessFeature
import qualified TD.Data.Animation as Animation
data BusinessFeaturePromotionAnimation
= BusinessFeaturePromotionAnimation
{ BusinessFeaturePromotionAnimation -> Maybe BusinessFeature
feature :: Maybe BusinessFeature.BusinessFeature
, BusinessFeaturePromotionAnimation -> Maybe Animation
animation :: Maybe Animation.Animation
}
deriving (BusinessFeaturePromotionAnimation
-> BusinessFeaturePromotionAnimation -> Bool
(BusinessFeaturePromotionAnimation
-> BusinessFeaturePromotionAnimation -> Bool)
-> (BusinessFeaturePromotionAnimation
-> BusinessFeaturePromotionAnimation -> Bool)
-> Eq BusinessFeaturePromotionAnimation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BusinessFeaturePromotionAnimation
-> BusinessFeaturePromotionAnimation -> Bool
== :: BusinessFeaturePromotionAnimation
-> BusinessFeaturePromotionAnimation -> Bool
$c/= :: BusinessFeaturePromotionAnimation
-> BusinessFeaturePromotionAnimation -> Bool
/= :: BusinessFeaturePromotionAnimation
-> BusinessFeaturePromotionAnimation -> Bool
Eq, Int -> BusinessFeaturePromotionAnimation -> ShowS
[BusinessFeaturePromotionAnimation] -> ShowS
BusinessFeaturePromotionAnimation -> String
(Int -> BusinessFeaturePromotionAnimation -> ShowS)
-> (BusinessFeaturePromotionAnimation -> String)
-> ([BusinessFeaturePromotionAnimation] -> ShowS)
-> Show BusinessFeaturePromotionAnimation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BusinessFeaturePromotionAnimation -> ShowS
showsPrec :: Int -> BusinessFeaturePromotionAnimation -> ShowS
$cshow :: BusinessFeaturePromotionAnimation -> String
show :: BusinessFeaturePromotionAnimation -> String
$cshowList :: [BusinessFeaturePromotionAnimation] -> ShowS
showList :: [BusinessFeaturePromotionAnimation] -> ShowS
Show)
instance I.ShortShow BusinessFeaturePromotionAnimation where
shortShow :: BusinessFeaturePromotionAnimation -> String
shortShow BusinessFeaturePromotionAnimation
{ feature :: BusinessFeaturePromotionAnimation -> Maybe BusinessFeature
feature = Maybe BusinessFeature
feature_
, animation :: BusinessFeaturePromotionAnimation -> Maybe Animation
animation = Maybe Animation
animation_
}
= String
"BusinessFeaturePromotionAnimation"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"feature" String -> Maybe BusinessFeature -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BusinessFeature
feature_
, String
"animation" String -> Maybe Animation -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Animation
animation_
]
instance AT.FromJSON BusinessFeaturePromotionAnimation where
parseJSON :: Value -> Parser BusinessFeaturePromotionAnimation
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
"businessFeaturePromotionAnimation" -> Value -> Parser BusinessFeaturePromotionAnimation
parseBusinessFeaturePromotionAnimation Value
v
String
_ -> Parser BusinessFeaturePromotionAnimation
forall a. Monoid a => a
mempty
where
parseBusinessFeaturePromotionAnimation :: A.Value -> AT.Parser BusinessFeaturePromotionAnimation
parseBusinessFeaturePromotionAnimation :: Value -> Parser BusinessFeaturePromotionAnimation
parseBusinessFeaturePromotionAnimation = String
-> (Object -> Parser BusinessFeaturePromotionAnimation)
-> Value
-> Parser BusinessFeaturePromotionAnimation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BusinessFeaturePromotionAnimation" ((Object -> Parser BusinessFeaturePromotionAnimation)
-> Value -> Parser BusinessFeaturePromotionAnimation)
-> (Object -> Parser BusinessFeaturePromotionAnimation)
-> Value
-> Parser BusinessFeaturePromotionAnimation
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe BusinessFeature
feature_ <- Object
o Object -> Key -> Parser (Maybe BusinessFeature)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"feature"
Maybe Animation
animation_ <- Object
o Object -> Key -> Parser (Maybe Animation)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"animation"
BusinessFeaturePromotionAnimation
-> Parser BusinessFeaturePromotionAnimation
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BusinessFeaturePromotionAnimation
-> Parser BusinessFeaturePromotionAnimation)
-> BusinessFeaturePromotionAnimation
-> Parser BusinessFeaturePromotionAnimation
forall a b. (a -> b) -> a -> b
$ BusinessFeaturePromotionAnimation
{ feature :: Maybe BusinessFeature
feature = Maybe BusinessFeature
feature_
, animation :: Maybe Animation
animation = Maybe Animation
animation_
}
parseJSON Value
_ = Parser BusinessFeaturePromotionAnimation
forall a. Monoid a => a
mempty