module TD.Data.EmojiCategoryType
(EmojiCategoryType(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data EmojiCategoryType
= EmojiCategoryTypeDefault
| EmojiCategoryTypeRegularStickers
| EmojiCategoryTypeEmojiStatus
| EmojiCategoryTypeChatPhoto
deriving (EmojiCategoryType -> EmojiCategoryType -> Bool
(EmojiCategoryType -> EmojiCategoryType -> Bool)
-> (EmojiCategoryType -> EmojiCategoryType -> Bool)
-> Eq EmojiCategoryType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EmojiCategoryType -> EmojiCategoryType -> Bool
== :: EmojiCategoryType -> EmojiCategoryType -> Bool
$c/= :: EmojiCategoryType -> EmojiCategoryType -> Bool
/= :: EmojiCategoryType -> EmojiCategoryType -> Bool
Eq, Int -> EmojiCategoryType -> ShowS
[EmojiCategoryType] -> ShowS
EmojiCategoryType -> String
(Int -> EmojiCategoryType -> ShowS)
-> (EmojiCategoryType -> String)
-> ([EmojiCategoryType] -> ShowS)
-> Show EmojiCategoryType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EmojiCategoryType -> ShowS
showsPrec :: Int -> EmojiCategoryType -> ShowS
$cshow :: EmojiCategoryType -> String
show :: EmojiCategoryType -> String
$cshowList :: [EmojiCategoryType] -> ShowS
showList :: [EmojiCategoryType] -> ShowS
Show)
instance I.ShortShow EmojiCategoryType where
shortShow :: EmojiCategoryType -> String
shortShow EmojiCategoryType
EmojiCategoryTypeDefault
= String
"EmojiCategoryTypeDefault"
shortShow EmojiCategoryType
EmojiCategoryTypeRegularStickers
= String
"EmojiCategoryTypeRegularStickers"
shortShow EmojiCategoryType
EmojiCategoryTypeEmojiStatus
= String
"EmojiCategoryTypeEmojiStatus"
shortShow EmojiCategoryType
EmojiCategoryTypeChatPhoto
= String
"EmojiCategoryTypeChatPhoto"
instance AT.FromJSON EmojiCategoryType where
parseJSON :: Value -> Parser EmojiCategoryType
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
"emojiCategoryTypeDefault" -> EmojiCategoryType -> Parser EmojiCategoryType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure EmojiCategoryType
EmojiCategoryTypeDefault
String
"emojiCategoryTypeRegularStickers" -> EmojiCategoryType -> Parser EmojiCategoryType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure EmojiCategoryType
EmojiCategoryTypeRegularStickers
String
"emojiCategoryTypeEmojiStatus" -> EmojiCategoryType -> Parser EmojiCategoryType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure EmojiCategoryType
EmojiCategoryTypeEmojiStatus
String
"emojiCategoryTypeChatPhoto" -> EmojiCategoryType -> Parser EmojiCategoryType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure EmojiCategoryType
EmojiCategoryTypeChatPhoto
String
_ -> Parser EmojiCategoryType
forall a. Monoid a => a
mempty
parseJSON Value
_ = Parser EmojiCategoryType
forall a. Monoid a => a
mempty
instance AT.ToJSON EmojiCategoryType where
toJSON :: EmojiCategoryType -> Value
toJSON EmojiCategoryType
EmojiCategoryTypeDefault
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"emojiCategoryTypeDefault"
]
toJSON EmojiCategoryType
EmojiCategoryTypeRegularStickers
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"emojiCategoryTypeRegularStickers"
]
toJSON EmojiCategoryType
EmojiCategoryTypeEmojiStatus
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"emojiCategoryTypeEmojiStatus"
]
toJSON EmojiCategoryType
EmojiCategoryTypeChatPhoto
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"emojiCategoryTypeChatPhoto"
]