module TD.Data.MaskPoint
(MaskPoint(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data MaskPoint
= MaskPointForehead
| MaskPointEyes
| MaskPointMouth
| MaskPointChin
deriving (MaskPoint -> MaskPoint -> Bool
(MaskPoint -> MaskPoint -> Bool)
-> (MaskPoint -> MaskPoint -> Bool) -> Eq MaskPoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MaskPoint -> MaskPoint -> Bool
== :: MaskPoint -> MaskPoint -> Bool
$c/= :: MaskPoint -> MaskPoint -> Bool
/= :: MaskPoint -> MaskPoint -> Bool
Eq, Int -> MaskPoint -> ShowS
[MaskPoint] -> ShowS
MaskPoint -> String
(Int -> MaskPoint -> ShowS)
-> (MaskPoint -> String)
-> ([MaskPoint] -> ShowS)
-> Show MaskPoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MaskPoint -> ShowS
showsPrec :: Int -> MaskPoint -> ShowS
$cshow :: MaskPoint -> String
show :: MaskPoint -> String
$cshowList :: [MaskPoint] -> ShowS
showList :: [MaskPoint] -> ShowS
Show)
instance I.ShortShow MaskPoint where
shortShow :: MaskPoint -> String
shortShow MaskPoint
MaskPointForehead
= String
"MaskPointForehead"
shortShow MaskPoint
MaskPointEyes
= String
"MaskPointEyes"
shortShow MaskPoint
MaskPointMouth
= String
"MaskPointMouth"
shortShow MaskPoint
MaskPointChin
= String
"MaskPointChin"
instance AT.FromJSON MaskPoint where
parseJSON :: Value -> Parser MaskPoint
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
"maskPointForehead" -> MaskPoint -> Parser MaskPoint
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure MaskPoint
MaskPointForehead
String
"maskPointEyes" -> MaskPoint -> Parser MaskPoint
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure MaskPoint
MaskPointEyes
String
"maskPointMouth" -> MaskPoint -> Parser MaskPoint
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure MaskPoint
MaskPointMouth
String
"maskPointChin" -> MaskPoint -> Parser MaskPoint
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure MaskPoint
MaskPointChin
String
_ -> Parser MaskPoint
forall a. Monoid a => a
mempty
parseJSON Value
_ = Parser MaskPoint
forall a. Monoid a => a
mempty
instance AT.ToJSON MaskPoint where
toJSON :: MaskPoint -> Value
toJSON MaskPoint
MaskPointForehead
= [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
"maskPointForehead"
]
toJSON MaskPoint
MaskPointEyes
= [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
"maskPointEyes"
]
toJSON MaskPoint
MaskPointMouth
= [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
"maskPointMouth"
]
toJSON MaskPoint
MaskPointChin
= [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
"maskPointChin"
]