module TD.Data.CheckChatUsernameResult
(CheckChatUsernameResult(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data CheckChatUsernameResult
= CheckChatUsernameResultOk
| CheckChatUsernameResultUsernameInvalid
| CheckChatUsernameResultUsernameOccupied
| CheckChatUsernameResultUsernamePurchasable
| CheckChatUsernameResultPublicChatsTooMany
| CheckChatUsernameResultPublicGroupsUnavailable
deriving (CheckChatUsernameResult -> CheckChatUsernameResult -> Bool
(CheckChatUsernameResult -> CheckChatUsernameResult -> Bool)
-> (CheckChatUsernameResult -> CheckChatUsernameResult -> Bool)
-> Eq CheckChatUsernameResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CheckChatUsernameResult -> CheckChatUsernameResult -> Bool
== :: CheckChatUsernameResult -> CheckChatUsernameResult -> Bool
$c/= :: CheckChatUsernameResult -> CheckChatUsernameResult -> Bool
/= :: CheckChatUsernameResult -> CheckChatUsernameResult -> Bool
Eq, Int -> CheckChatUsernameResult -> ShowS
[CheckChatUsernameResult] -> ShowS
CheckChatUsernameResult -> String
(Int -> CheckChatUsernameResult -> ShowS)
-> (CheckChatUsernameResult -> String)
-> ([CheckChatUsernameResult] -> ShowS)
-> Show CheckChatUsernameResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CheckChatUsernameResult -> ShowS
showsPrec :: Int -> CheckChatUsernameResult -> ShowS
$cshow :: CheckChatUsernameResult -> String
show :: CheckChatUsernameResult -> String
$cshowList :: [CheckChatUsernameResult] -> ShowS
showList :: [CheckChatUsernameResult] -> ShowS
Show)
instance I.ShortShow CheckChatUsernameResult where
shortShow :: CheckChatUsernameResult -> String
shortShow CheckChatUsernameResult
CheckChatUsernameResultOk
= String
"CheckChatUsernameResultOk"
shortShow CheckChatUsernameResult
CheckChatUsernameResultUsernameInvalid
= String
"CheckChatUsernameResultUsernameInvalid"
shortShow CheckChatUsernameResult
CheckChatUsernameResultUsernameOccupied
= String
"CheckChatUsernameResultUsernameOccupied"
shortShow CheckChatUsernameResult
CheckChatUsernameResultUsernamePurchasable
= String
"CheckChatUsernameResultUsernamePurchasable"
shortShow CheckChatUsernameResult
CheckChatUsernameResultPublicChatsTooMany
= String
"CheckChatUsernameResultPublicChatsTooMany"
shortShow CheckChatUsernameResult
CheckChatUsernameResultPublicGroupsUnavailable
= String
"CheckChatUsernameResultPublicGroupsUnavailable"
instance AT.FromJSON CheckChatUsernameResult where
parseJSON :: Value -> Parser CheckChatUsernameResult
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
"checkChatUsernameResultOk" -> CheckChatUsernameResult -> Parser CheckChatUsernameResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CheckChatUsernameResult
CheckChatUsernameResultOk
String
"checkChatUsernameResultUsernameInvalid" -> CheckChatUsernameResult -> Parser CheckChatUsernameResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CheckChatUsernameResult
CheckChatUsernameResultUsernameInvalid
String
"checkChatUsernameResultUsernameOccupied" -> CheckChatUsernameResult -> Parser CheckChatUsernameResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CheckChatUsernameResult
CheckChatUsernameResultUsernameOccupied
String
"checkChatUsernameResultUsernamePurchasable" -> CheckChatUsernameResult -> Parser CheckChatUsernameResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CheckChatUsernameResult
CheckChatUsernameResultUsernamePurchasable
String
"checkChatUsernameResultPublicChatsTooMany" -> CheckChatUsernameResult -> Parser CheckChatUsernameResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CheckChatUsernameResult
CheckChatUsernameResultPublicChatsTooMany
String
"checkChatUsernameResultPublicGroupsUnavailable" -> CheckChatUsernameResult -> Parser CheckChatUsernameResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CheckChatUsernameResult
CheckChatUsernameResultPublicGroupsUnavailable
String
_ -> Parser CheckChatUsernameResult
forall a. Monoid a => a
mempty
parseJSON Value
_ = Parser CheckChatUsernameResult
forall a. Monoid a => a
mempty