module TD.Data.ChatBoostFeatures
(ChatBoostFeatures(..)) 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.ChatBoostLevelFeatures as ChatBoostLevelFeatures
data ChatBoostFeatures
= ChatBoostFeatures
{ ChatBoostFeatures -> Maybe [ChatBoostLevelFeatures]
features :: Maybe [ChatBoostLevelFeatures.ChatBoostLevelFeatures]
, ChatBoostFeatures -> Maybe Int
min_profile_background_custom_emoji_boost_level :: Maybe Int
, ChatBoostFeatures -> Maybe Int
min_background_custom_emoji_boost_level :: Maybe Int
, ChatBoostFeatures -> Maybe Int
min_emoji_status_boost_level :: Maybe Int
, ChatBoostFeatures -> Maybe Int
min_chat_theme_background_boost_level :: Maybe Int
, ChatBoostFeatures -> Maybe Int
min_custom_background_boost_level :: Maybe Int
, ChatBoostFeatures -> Maybe Int
min_custom_emoji_sticker_set_boost_level :: Maybe Int
, ChatBoostFeatures -> Maybe Int
min_speech_recognition_boost_level :: Maybe Int
, :: Maybe Int
}
deriving (ChatBoostFeatures -> ChatBoostFeatures -> Bool
(ChatBoostFeatures -> ChatBoostFeatures -> Bool)
-> (ChatBoostFeatures -> ChatBoostFeatures -> Bool)
-> Eq ChatBoostFeatures
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ChatBoostFeatures -> ChatBoostFeatures -> Bool
== :: ChatBoostFeatures -> ChatBoostFeatures -> Bool
$c/= :: ChatBoostFeatures -> ChatBoostFeatures -> Bool
/= :: ChatBoostFeatures -> ChatBoostFeatures -> Bool
Eq, Int -> ChatBoostFeatures -> ShowS
[ChatBoostFeatures] -> ShowS
ChatBoostFeatures -> String
(Int -> ChatBoostFeatures -> ShowS)
-> (ChatBoostFeatures -> String)
-> ([ChatBoostFeatures] -> ShowS)
-> Show ChatBoostFeatures
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChatBoostFeatures -> ShowS
showsPrec :: Int -> ChatBoostFeatures -> ShowS
$cshow :: ChatBoostFeatures -> String
show :: ChatBoostFeatures -> String
$cshowList :: [ChatBoostFeatures] -> ShowS
showList :: [ChatBoostFeatures] -> ShowS
Show)
instance I.ShortShow ChatBoostFeatures where
shortShow :: ChatBoostFeatures -> String
shortShow ChatBoostFeatures
{ features :: ChatBoostFeatures -> Maybe [ChatBoostLevelFeatures]
features = Maybe [ChatBoostLevelFeatures]
features_
, min_profile_background_custom_emoji_boost_level :: ChatBoostFeatures -> Maybe Int
min_profile_background_custom_emoji_boost_level = Maybe Int
min_profile_background_custom_emoji_boost_level_
, min_background_custom_emoji_boost_level :: ChatBoostFeatures -> Maybe Int
min_background_custom_emoji_boost_level = Maybe Int
min_background_custom_emoji_boost_level_
, min_emoji_status_boost_level :: ChatBoostFeatures -> Maybe Int
min_emoji_status_boost_level = Maybe Int
min_emoji_status_boost_level_
, min_chat_theme_background_boost_level :: ChatBoostFeatures -> Maybe Int
min_chat_theme_background_boost_level = Maybe Int
min_chat_theme_background_boost_level_
, min_custom_background_boost_level :: ChatBoostFeatures -> Maybe Int
min_custom_background_boost_level = Maybe Int
min_custom_background_boost_level_
, min_custom_emoji_sticker_set_boost_level :: ChatBoostFeatures -> Maybe Int
min_custom_emoji_sticker_set_boost_level = Maybe Int
min_custom_emoji_sticker_set_boost_level_
, min_speech_recognition_boost_level :: ChatBoostFeatures -> Maybe Int
min_speech_recognition_boost_level = Maybe Int
min_speech_recognition_boost_level_
, min_sponsored_message_disable_boost_level :: ChatBoostFeatures -> Maybe Int
min_sponsored_message_disable_boost_level = Maybe Int
min_sponsored_message_disable_boost_level_
}
= String
"ChatBoostFeatures"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"features" String -> Maybe [ChatBoostLevelFeatures] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [ChatBoostLevelFeatures]
features_
, String
"min_profile_background_custom_emoji_boost_level" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
min_profile_background_custom_emoji_boost_level_
, String
"min_background_custom_emoji_boost_level" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
min_background_custom_emoji_boost_level_
, String
"min_emoji_status_boost_level" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
min_emoji_status_boost_level_
, String
"min_chat_theme_background_boost_level" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
min_chat_theme_background_boost_level_
, String
"min_custom_background_boost_level" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
min_custom_background_boost_level_
, String
"min_custom_emoji_sticker_set_boost_level" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
min_custom_emoji_sticker_set_boost_level_
, String
"min_speech_recognition_boost_level" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
min_speech_recognition_boost_level_
, String
"min_sponsored_message_disable_boost_level" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
min_sponsored_message_disable_boost_level_
]
instance AT.FromJSON ChatBoostFeatures where
parseJSON :: Value -> Parser ChatBoostFeatures
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
"chatBoostFeatures" -> Value -> Parser ChatBoostFeatures
parseChatBoostFeatures Value
v
String
_ -> Parser ChatBoostFeatures
forall a. Monoid a => a
mempty
where
parseChatBoostFeatures :: A.Value -> AT.Parser ChatBoostFeatures
parseChatBoostFeatures :: Value -> Parser ChatBoostFeatures
parseChatBoostFeatures = String
-> (Object -> Parser ChatBoostFeatures)
-> Value
-> Parser ChatBoostFeatures
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"ChatBoostFeatures" ((Object -> Parser ChatBoostFeatures)
-> Value -> Parser ChatBoostFeatures)
-> (Object -> Parser ChatBoostFeatures)
-> Value
-> Parser ChatBoostFeatures
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe [ChatBoostLevelFeatures]
features_ <- Object
o Object -> Key -> Parser (Maybe [ChatBoostLevelFeatures])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"features"
Maybe Int
min_profile_background_custom_emoji_boost_level_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"min_profile_background_custom_emoji_boost_level"
Maybe Int
min_background_custom_emoji_boost_level_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"min_background_custom_emoji_boost_level"
Maybe Int
min_emoji_status_boost_level_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"min_emoji_status_boost_level"
Maybe Int
min_chat_theme_background_boost_level_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"min_chat_theme_background_boost_level"
Maybe Int
min_custom_background_boost_level_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"min_custom_background_boost_level"
Maybe Int
min_custom_emoji_sticker_set_boost_level_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"min_custom_emoji_sticker_set_boost_level"
Maybe Int
min_speech_recognition_boost_level_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"min_speech_recognition_boost_level"
Maybe Int
min_sponsored_message_disable_boost_level_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"min_sponsored_message_disable_boost_level"
ChatBoostFeatures -> Parser ChatBoostFeatures
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ChatBoostFeatures -> Parser ChatBoostFeatures)
-> ChatBoostFeatures -> Parser ChatBoostFeatures
forall a b. (a -> b) -> a -> b
$ ChatBoostFeatures
{ features :: Maybe [ChatBoostLevelFeatures]
features = Maybe [ChatBoostLevelFeatures]
features_
, min_profile_background_custom_emoji_boost_level :: Maybe Int
min_profile_background_custom_emoji_boost_level = Maybe Int
min_profile_background_custom_emoji_boost_level_
, min_background_custom_emoji_boost_level :: Maybe Int
min_background_custom_emoji_boost_level = Maybe Int
min_background_custom_emoji_boost_level_
, min_emoji_status_boost_level :: Maybe Int
min_emoji_status_boost_level = Maybe Int
min_emoji_status_boost_level_
, min_chat_theme_background_boost_level :: Maybe Int
min_chat_theme_background_boost_level = Maybe Int
min_chat_theme_background_boost_level_
, min_custom_background_boost_level :: Maybe Int
min_custom_background_boost_level = Maybe Int
min_custom_background_boost_level_
, min_custom_emoji_sticker_set_boost_level :: Maybe Int
min_custom_emoji_sticker_set_boost_level = Maybe Int
min_custom_emoji_sticker_set_boost_level_
, min_speech_recognition_boost_level :: Maybe Int
min_speech_recognition_boost_level = Maybe Int
min_speech_recognition_boost_level_
, min_sponsored_message_disable_boost_level :: Maybe Int
min_sponsored_message_disable_boost_level = Maybe Int
min_sponsored_message_disable_boost_level_
}
parseJSON Value
_ = Parser ChatBoostFeatures
forall a. Monoid a => a
mempty