module TD.Data.PageBlockTableCell
(PageBlockTableCell(..)) 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.RichText as RichText
import qualified TD.Data.PageBlockHorizontalAlignment as PageBlockHorizontalAlignment
import qualified TD.Data.PageBlockVerticalAlignment as PageBlockVerticalAlignment
data PageBlockTableCell
= PageBlockTableCell
{ PageBlockTableCell -> Maybe RichText
text :: Maybe RichText.RichText
, :: Maybe Bool
, PageBlockTableCell -> Maybe Int
colspan :: Maybe Int
, PageBlockTableCell -> Maybe Int
rowspan :: Maybe Int
, PageBlockTableCell -> Maybe PageBlockHorizontalAlignment
align :: Maybe PageBlockHorizontalAlignment.PageBlockHorizontalAlignment
, PageBlockTableCell -> Maybe PageBlockVerticalAlignment
valign :: Maybe PageBlockVerticalAlignment.PageBlockVerticalAlignment
}
deriving (PageBlockTableCell -> PageBlockTableCell -> Bool
(PageBlockTableCell -> PageBlockTableCell -> Bool)
-> (PageBlockTableCell -> PageBlockTableCell -> Bool)
-> Eq PageBlockTableCell
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PageBlockTableCell -> PageBlockTableCell -> Bool
== :: PageBlockTableCell -> PageBlockTableCell -> Bool
$c/= :: PageBlockTableCell -> PageBlockTableCell -> Bool
/= :: PageBlockTableCell -> PageBlockTableCell -> Bool
Eq, Int -> PageBlockTableCell -> ShowS
[PageBlockTableCell] -> ShowS
PageBlockTableCell -> String
(Int -> PageBlockTableCell -> ShowS)
-> (PageBlockTableCell -> String)
-> ([PageBlockTableCell] -> ShowS)
-> Show PageBlockTableCell
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PageBlockTableCell -> ShowS
showsPrec :: Int -> PageBlockTableCell -> ShowS
$cshow :: PageBlockTableCell -> String
show :: PageBlockTableCell -> String
$cshowList :: [PageBlockTableCell] -> ShowS
showList :: [PageBlockTableCell] -> ShowS
Show)
instance I.ShortShow PageBlockTableCell where
shortShow :: PageBlockTableCell -> String
shortShow PageBlockTableCell
{ text :: PageBlockTableCell -> Maybe RichText
text = Maybe RichText
text_
, is_header :: PageBlockTableCell -> Maybe Bool
is_header = Maybe Bool
is_header_
, colspan :: PageBlockTableCell -> Maybe Int
colspan = Maybe Int
colspan_
, rowspan :: PageBlockTableCell -> Maybe Int
rowspan = Maybe Int
rowspan_
, align :: PageBlockTableCell -> Maybe PageBlockHorizontalAlignment
align = Maybe PageBlockHorizontalAlignment
align_
, valign :: PageBlockTableCell -> Maybe PageBlockVerticalAlignment
valign = Maybe PageBlockVerticalAlignment
valign_
}
= String
"PageBlockTableCell"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"text" String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
text_
, String
"is_header" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_header_
, String
"colspan" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
colspan_
, String
"rowspan" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
rowspan_
, String
"align" String -> Maybe PageBlockHorizontalAlignment -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockHorizontalAlignment
align_
, String
"valign" String -> Maybe PageBlockVerticalAlignment -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockVerticalAlignment
valign_
]
instance AT.FromJSON PageBlockTableCell where
parseJSON :: Value -> Parser PageBlockTableCell
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
"pageBlockTableCell" -> Value -> Parser PageBlockTableCell
parsePageBlockTableCell Value
v
String
_ -> Parser PageBlockTableCell
forall a. Monoid a => a
mempty
where
parsePageBlockTableCell :: A.Value -> AT.Parser PageBlockTableCell
parsePageBlockTableCell :: Value -> Parser PageBlockTableCell
parsePageBlockTableCell = String
-> (Object -> Parser PageBlockTableCell)
-> Value
-> Parser PageBlockTableCell
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockTableCell" ((Object -> Parser PageBlockTableCell)
-> Value -> Parser PageBlockTableCell)
-> (Object -> Parser PageBlockTableCell)
-> Value
-> Parser PageBlockTableCell
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe RichText
text_ <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"text"
Maybe Bool
is_header_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_header"
Maybe Int
colspan_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"colspan"
Maybe Int
rowspan_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"rowspan"
Maybe PageBlockHorizontalAlignment
align_ <- Object
o Object -> Key -> Parser (Maybe PageBlockHorizontalAlignment)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"align"
Maybe PageBlockVerticalAlignment
valign_ <- Object
o Object -> Key -> Parser (Maybe PageBlockVerticalAlignment)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"valign"
PageBlockTableCell -> Parser PageBlockTableCell
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlockTableCell -> Parser PageBlockTableCell)
-> PageBlockTableCell -> Parser PageBlockTableCell
forall a b. (a -> b) -> a -> b
$ PageBlockTableCell
{ text :: Maybe RichText
text = Maybe RichText
text_
, is_header :: Maybe Bool
is_header = Maybe Bool
is_header_
, colspan :: Maybe Int
colspan = Maybe Int
colspan_
, rowspan :: Maybe Int
rowspan = Maybe Int
rowspan_
, align :: Maybe PageBlockHorizontalAlignment
align = Maybe PageBlockHorizontalAlignment
align_
, valign :: Maybe PageBlockVerticalAlignment
valign = Maybe PageBlockVerticalAlignment
valign_
}
parseJSON Value
_ = Parser PageBlockTableCell
forall a. Monoid a => a
mempty