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