module TD.Data.ThumbnailFormat
(ThumbnailFormat(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data ThumbnailFormat
= ThumbnailFormatJpeg
| ThumbnailFormatGif
| ThumbnailFormatMpeg4
| ThumbnailFormatPng
| ThumbnailFormatTgs
| ThumbnailFormatWebm
| ThumbnailFormatWebp
deriving (ThumbnailFormat -> ThumbnailFormat -> Bool
(ThumbnailFormat -> ThumbnailFormat -> Bool)
-> (ThumbnailFormat -> ThumbnailFormat -> Bool)
-> Eq ThumbnailFormat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ThumbnailFormat -> ThumbnailFormat -> Bool
== :: ThumbnailFormat -> ThumbnailFormat -> Bool
$c/= :: ThumbnailFormat -> ThumbnailFormat -> Bool
/= :: ThumbnailFormat -> ThumbnailFormat -> Bool
Eq, Int -> ThumbnailFormat -> ShowS
[ThumbnailFormat] -> ShowS
ThumbnailFormat -> String
(Int -> ThumbnailFormat -> ShowS)
-> (ThumbnailFormat -> String)
-> ([ThumbnailFormat] -> ShowS)
-> Show ThumbnailFormat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ThumbnailFormat -> ShowS
showsPrec :: Int -> ThumbnailFormat -> ShowS
$cshow :: ThumbnailFormat -> String
show :: ThumbnailFormat -> String
$cshowList :: [ThumbnailFormat] -> ShowS
showList :: [ThumbnailFormat] -> ShowS
Show)
instance I.ShortShow ThumbnailFormat where
shortShow :: ThumbnailFormat -> String
shortShow ThumbnailFormat
ThumbnailFormatJpeg
= String
"ThumbnailFormatJpeg"
shortShow ThumbnailFormat
ThumbnailFormatGif
= String
"ThumbnailFormatGif"
shortShow ThumbnailFormat
ThumbnailFormatMpeg4
= String
"ThumbnailFormatMpeg4"
shortShow ThumbnailFormat
ThumbnailFormatPng
= String
"ThumbnailFormatPng"
shortShow ThumbnailFormat
ThumbnailFormatTgs
= String
"ThumbnailFormatTgs"
shortShow ThumbnailFormat
ThumbnailFormatWebm
= String
"ThumbnailFormatWebm"
shortShow ThumbnailFormat
ThumbnailFormatWebp
= String
"ThumbnailFormatWebp"
instance AT.FromJSON ThumbnailFormat where
parseJSON :: Value -> Parser ThumbnailFormat
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
"thumbnailFormatJpeg" -> ThumbnailFormat -> Parser ThumbnailFormat
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ThumbnailFormat
ThumbnailFormatJpeg
String
"thumbnailFormatGif" -> ThumbnailFormat -> Parser ThumbnailFormat
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ThumbnailFormat
ThumbnailFormatGif
String
"thumbnailFormatMpeg4" -> ThumbnailFormat -> Parser ThumbnailFormat
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ThumbnailFormat
ThumbnailFormatMpeg4
String
"thumbnailFormatPng" -> ThumbnailFormat -> Parser ThumbnailFormat
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ThumbnailFormat
ThumbnailFormatPng
String
"thumbnailFormatTgs" -> ThumbnailFormat -> Parser ThumbnailFormat
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ThumbnailFormat
ThumbnailFormatTgs
String
"thumbnailFormatWebm" -> ThumbnailFormat -> Parser ThumbnailFormat
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ThumbnailFormat
ThumbnailFormatWebm
String
"thumbnailFormatWebp" -> ThumbnailFormat -> Parser ThumbnailFormat
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ThumbnailFormat
ThumbnailFormatWebp
String
_ -> Parser ThumbnailFormat
forall a. Monoid a => a
mempty
parseJSON Value
_ = Parser ThumbnailFormat
forall a. Monoid a => a
mempty