module TD.Data.VideoStoryboard
(VideoStoryboard(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.File as File
data VideoStoryboard
= VideoStoryboard
{ VideoStoryboard -> Maybe File
storyboard_file :: Maybe File.File
, VideoStoryboard -> Maybe Int
width :: Maybe Int
, VideoStoryboard -> Maybe Int
height :: Maybe Int
, VideoStoryboard -> Maybe File
map_file :: Maybe File.File
}
deriving (VideoStoryboard -> VideoStoryboard -> Bool
(VideoStoryboard -> VideoStoryboard -> Bool)
-> (VideoStoryboard -> VideoStoryboard -> Bool)
-> Eq VideoStoryboard
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VideoStoryboard -> VideoStoryboard -> Bool
== :: VideoStoryboard -> VideoStoryboard -> Bool
$c/= :: VideoStoryboard -> VideoStoryboard -> Bool
/= :: VideoStoryboard -> VideoStoryboard -> Bool
Eq, Int -> VideoStoryboard -> ShowS
[VideoStoryboard] -> ShowS
VideoStoryboard -> String
(Int -> VideoStoryboard -> ShowS)
-> (VideoStoryboard -> String)
-> ([VideoStoryboard] -> ShowS)
-> Show VideoStoryboard
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VideoStoryboard -> ShowS
showsPrec :: Int -> VideoStoryboard -> ShowS
$cshow :: VideoStoryboard -> String
show :: VideoStoryboard -> String
$cshowList :: [VideoStoryboard] -> ShowS
showList :: [VideoStoryboard] -> ShowS
Show)
instance I.ShortShow VideoStoryboard where
shortShow :: VideoStoryboard -> String
shortShow VideoStoryboard
{ storyboard_file :: VideoStoryboard -> Maybe File
storyboard_file = Maybe File
storyboard_file_
, width :: VideoStoryboard -> Maybe Int
width = Maybe Int
width_
, height :: VideoStoryboard -> Maybe Int
height = Maybe Int
height_
, map_file :: VideoStoryboard -> Maybe File
map_file = Maybe File
map_file_
}
= String
"VideoStoryboard"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"storyboard_file" String -> Maybe File -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe File
storyboard_file_
, String
"width" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
width_
, String
"height" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
height_
, String
"map_file" String -> Maybe File -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe File
map_file_
]
instance AT.FromJSON VideoStoryboard where
parseJSON :: Value -> Parser VideoStoryboard
parseJSON v :: Value
v@(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
"videoStoryboard" -> Value -> Parser VideoStoryboard
parseVideoStoryboard Value
v
String
_ -> Parser VideoStoryboard
forall a. Monoid a => a
mempty
where
parseVideoStoryboard :: A.Value -> AT.Parser VideoStoryboard
parseVideoStoryboard :: Value -> Parser VideoStoryboard
parseVideoStoryboard = String
-> (Object -> Parser VideoStoryboard)
-> Value
-> Parser VideoStoryboard
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"VideoStoryboard" ((Object -> Parser VideoStoryboard)
-> Value -> Parser VideoStoryboard)
-> (Object -> Parser VideoStoryboard)
-> Value
-> Parser VideoStoryboard
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe File
storyboard_file_ <- Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"storyboard_file"
Maybe Int
width_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"width"
Maybe Int
height_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"height"
Maybe File
map_file_ <- Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"map_file"
VideoStoryboard -> Parser VideoStoryboard
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (VideoStoryboard -> Parser VideoStoryboard)
-> VideoStoryboard -> Parser VideoStoryboard
forall a b. (a -> b) -> a -> b
$ VideoStoryboard
{ storyboard_file :: Maybe File
storyboard_file = Maybe File
storyboard_file_
, width :: Maybe Int
width = Maybe Int
width_
, height :: Maybe Int
height = Maybe Int
height_
, map_file :: Maybe File
map_file = Maybe File
map_file_
}
parseJSON Value
_ = Parser VideoStoryboard
forall a. Monoid a => a
mempty