module TD.Data.NotificationGroupType
(NotificationGroupType(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data NotificationGroupType
= NotificationGroupTypeMessages
| NotificationGroupTypeMentions
| NotificationGroupTypeSecretChat
| NotificationGroupTypeCalls
deriving (NotificationGroupType -> NotificationGroupType -> Bool
(NotificationGroupType -> NotificationGroupType -> Bool)
-> (NotificationGroupType -> NotificationGroupType -> Bool)
-> Eq NotificationGroupType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NotificationGroupType -> NotificationGroupType -> Bool
== :: NotificationGroupType -> NotificationGroupType -> Bool
$c/= :: NotificationGroupType -> NotificationGroupType -> Bool
/= :: NotificationGroupType -> NotificationGroupType -> Bool
Eq, Int -> NotificationGroupType -> ShowS
[NotificationGroupType] -> ShowS
NotificationGroupType -> String
(Int -> NotificationGroupType -> ShowS)
-> (NotificationGroupType -> String)
-> ([NotificationGroupType] -> ShowS)
-> Show NotificationGroupType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NotificationGroupType -> ShowS
showsPrec :: Int -> NotificationGroupType -> ShowS
$cshow :: NotificationGroupType -> String
show :: NotificationGroupType -> String
$cshowList :: [NotificationGroupType] -> ShowS
showList :: [NotificationGroupType] -> ShowS
Show)
instance I.ShortShow NotificationGroupType where
shortShow :: NotificationGroupType -> String
shortShow NotificationGroupType
NotificationGroupTypeMessages
= String
"NotificationGroupTypeMessages"
shortShow NotificationGroupType
NotificationGroupTypeMentions
= String
"NotificationGroupTypeMentions"
shortShow NotificationGroupType
NotificationGroupTypeSecretChat
= String
"NotificationGroupTypeSecretChat"
shortShow NotificationGroupType
NotificationGroupTypeCalls
= String
"NotificationGroupTypeCalls"
instance AT.FromJSON NotificationGroupType where
parseJSON :: Value -> Parser NotificationGroupType
parseJSON (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
"notificationGroupTypeMessages" -> NotificationGroupType -> Parser NotificationGroupType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationGroupType
NotificationGroupTypeMessages
String
"notificationGroupTypeMentions" -> NotificationGroupType -> Parser NotificationGroupType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationGroupType
NotificationGroupTypeMentions
String
"notificationGroupTypeSecretChat" -> NotificationGroupType -> Parser NotificationGroupType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationGroupType
NotificationGroupTypeSecretChat
String
"notificationGroupTypeCalls" -> NotificationGroupType -> Parser NotificationGroupType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationGroupType
NotificationGroupTypeCalls
String
_ -> Parser NotificationGroupType
forall a. Monoid a => a
mempty
parseJSON Value
_ = Parser NotificationGroupType
forall a. Monoid a => a
mempty