module TD.Data.RichText
  (RichText(..)) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
import qualified TD.Data.DateTimeFormattingType as DateTimeFormattingType
import qualified TD.Data.Document as Document

-- | Describes a formatted text object
data RichText
  = RichTextPlain -- ^ A plain text
    { RichText -> Maybe Text
text :: Maybe T.Text -- ^ Text
    }
  | RichTextBold -- ^ A bold rich text
    { RichText -> Maybe RichText
_text :: Maybe RichText -- ^ Text
    }
  | RichTextItalic -- ^ An italicized rich text
    { _text :: Maybe RichText -- ^ Text
    }
  | RichTextUnderline -- ^ An underlined rich text
    { _text :: Maybe RichText -- ^ Text
    }
  | RichTextStrikethrough -- ^ A strikethrough rich text
    { _text :: Maybe RichText -- ^ Text
    }
  | RichTextSpoiler -- ^ A spoilered rich text
    { _text :: Maybe RichText -- ^ Text
    }
  | RichTextDateTime -- ^ A date and time
    { _text           :: Maybe RichText                                      -- ^ Original text
    , RichText -> Maybe Int
unix_time       :: Maybe Int                                           -- ^ Point in time (Unix timestamp) representing the date and time
    , RichText -> Maybe DateTimeFormattingType
formatting_type :: Maybe DateTimeFormattingType.DateTimeFormattingType -- ^ Date and time formatting type; may be null if none and the original text must not be changed
    }
  | RichTextMention -- ^ A mention of a Telegram user or chat by a username
    { _text    :: Maybe RichText -- ^ Text
    , RichText -> Maybe Text
username :: Maybe T.Text   -- ^ The username
    }
  | RichTextHashtag -- ^ A hashtag
    { _text   :: Maybe RichText -- ^ Text
    , RichText -> Maybe Text
hashtag :: Maybe T.Text   -- ^ The hashtag
    }
  | RichTextCashtag -- ^ A cashtag
    { _text   :: Maybe RichText -- ^ Text
    , RichText -> Maybe Text
cashtag :: Maybe T.Text   -- ^ The cashtag
    }
  | RichTextBotCommand -- ^ A bot command
    { _text       :: Maybe RichText -- ^ Text
    , RichText -> Maybe Text
bot_command :: Maybe T.Text   -- ^ The bot command
    }
  | RichTextFixed -- ^ A fixed-width rich text
    { _text :: Maybe RichText -- ^ Text
    }
  | RichTextMentionName -- ^ A rich text that serves as a mention of a user
    { _text   :: Maybe RichText -- ^ Text
    , RichText -> Maybe Int
user_id :: Maybe Int      -- ^ Identifier of the mentioned user
    }
  | RichTextUrl -- ^ A rich text URL link
    { _text     :: Maybe RichText -- ^ Text
    , RichText -> Maybe Text
url       :: Maybe T.Text   -- ^ URL
    , RichText -> Maybe Bool
is_cached :: Maybe Bool     -- ^ True, if the URL has cached instant view server-side; instant view only
    }
  | RichTextEmailAddress -- ^ A rich text email address
    { _text         :: Maybe RichText -- ^ Text
    , RichText -> Maybe Text
email_address :: Maybe T.Text   -- ^ Email address
    }
  | RichTextBankCardNumber -- ^ A bank card number
    { _text            :: Maybe RichText -- ^ Text
    , RichText -> Maybe Text
bank_card_number :: Maybe T.Text   -- ^ The number of the bank card
    }
  | RichTextSubscript -- ^ A subscript rich text
    { _text :: Maybe RichText -- ^ Text
    }
  | RichTextSuperscript -- ^ A superscript rich text
    { _text :: Maybe RichText -- ^ Text
    }
  | RichTextMarked -- ^ A marked rich text
    { _text :: Maybe RichText -- ^ Text
    }
  | RichTextPhoneNumber -- ^ A rich text phone number
    { _text        :: Maybe RichText -- ^ Text
    , RichText -> Maybe Text
phone_number :: Maybe T.Text   -- ^ Phone number
    }
  | RichTextCustomEmoji -- ^ A custom emoji
    { RichText -> Maybe Int
custom_emoji_id  :: Maybe Int    -- ^ Unique identifier of the custom emoji
    , RichText -> Maybe Text
alternative_text :: Maybe T.Text -- ^ Alternative text for the custom emoji
    }
  | RichTextIcon -- ^ A small image inside the text; instant view only
    { RichText -> Maybe Document
document :: Maybe Document.Document -- ^ The image represented as a document. The image can be in GIF, JPEG or PNG format
    , RichText -> Maybe Int
width    :: Maybe Int               -- ^ Width of a bounding box in which the image must be shown; 0 if unknown
    , RichText -> Maybe Int
height   :: Maybe Int               -- ^ Height of a bounding box in which the image must be shown; 0 if unknown
    }
  | RichTextMathematicalExpression -- ^ A mathematical expression
    { RichText -> Maybe Text
expression :: Maybe T.Text -- ^ The expression in LaTeX format
    }
  | RichTextReference -- ^ A reference
    { RichText -> Maybe Text
name  :: Maybe T.Text   -- ^ Reference name
    , _text :: Maybe RichText -- ^ Text of the reference
    }
  | RichTextReferenceLink -- ^ A link to a reference on the same page
    { _text          :: Maybe RichText -- ^ The link text
    , RichText -> Maybe Text
reference_name :: Maybe T.Text   -- ^ The reference name
    , url            :: Maybe T.Text   -- ^ An HTTP URL that opens the reference
    }
  | RichTextAnchor -- ^ An anchor
    { name :: Maybe T.Text -- ^ Anchor name
    }
  | RichTextAnchorLink -- ^ A link to an anchor on the same page
    { _text       :: Maybe RichText -- ^ The link text
    , RichText -> Maybe Text
anchor_name :: Maybe T.Text   -- ^ The anchor name. If the name is empty, the link must bring back to top
    , url         :: Maybe T.Text   -- ^ An HTTP URL that opens the anchor
    }
  | RichTexts -- ^ A concatenation of rich texts
    { RichText -> Maybe [RichText]
texts :: Maybe [RichText] -- ^ Texts
    }
  deriving (RichText -> RichText -> Bool
(RichText -> RichText -> Bool)
-> (RichText -> RichText -> Bool) -> Eq RichText
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RichText -> RichText -> Bool
== :: RichText -> RichText -> Bool
$c/= :: RichText -> RichText -> Bool
/= :: RichText -> RichText -> Bool
Eq, Int -> RichText -> ShowS
[RichText] -> ShowS
RichText -> String
(Int -> RichText -> ShowS)
-> (RichText -> String) -> ([RichText] -> ShowS) -> Show RichText
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RichText -> ShowS
showsPrec :: Int -> RichText -> ShowS
$cshow :: RichText -> String
show :: RichText -> String
$cshowList :: [RichText] -> ShowS
showList :: [RichText] -> ShowS
Show)

instance I.ShortShow RichText where
  shortShow :: RichText -> String
shortShow RichTextPlain
    { text :: RichText -> Maybe Text
text = Maybe Text
text_
    }
      = String
"RichTextPlain"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"text" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
text_
        ]
  shortShow RichTextBold
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = String
"RichTextBold"
        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_
        ]
  shortShow RichTextItalic
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = String
"RichTextItalic"
        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_
        ]
  shortShow RichTextUnderline
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = String
"RichTextUnderline"
        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_
        ]
  shortShow RichTextStrikethrough
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = String
"RichTextStrikethrough"
        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_
        ]
  shortShow RichTextSpoiler
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = String
"RichTextSpoiler"
        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_
        ]
  shortShow RichTextDateTime
    { _text :: RichText -> Maybe RichText
_text           = Maybe RichText
_text_
    , unix_time :: RichText -> Maybe Int
unix_time       = Maybe Int
unix_time_
    , formatting_type :: RichText -> Maybe DateTimeFormattingType
formatting_type = Maybe DateTimeFormattingType
formatting_type_
    }
      = String
"RichTextDateTime"
        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
"unix_time"       String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
unix_time_
        , String
"formatting_type" String -> Maybe DateTimeFormattingType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe DateTimeFormattingType
formatting_type_
        ]
  shortShow RichTextMention
    { _text :: RichText -> Maybe RichText
_text    = Maybe RichText
_text_
    , username :: RichText -> Maybe Text
username = Maybe Text
username_
    }
      = String
"RichTextMention"
        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
"username" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
username_
        ]
  shortShow RichTextHashtag
    { _text :: RichText -> Maybe RichText
_text   = Maybe RichText
_text_
    , hashtag :: RichText -> Maybe Text
hashtag = Maybe Text
hashtag_
    }
      = String
"RichTextHashtag"
        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
"hashtag" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
hashtag_
        ]
  shortShow RichTextCashtag
    { _text :: RichText -> Maybe RichText
_text   = Maybe RichText
_text_
    , cashtag :: RichText -> Maybe Text
cashtag = Maybe Text
cashtag_
    }
      = String
"RichTextCashtag"
        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
"cashtag" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
cashtag_
        ]
  shortShow RichTextBotCommand
    { _text :: RichText -> Maybe RichText
_text       = Maybe RichText
_text_
    , bot_command :: RichText -> Maybe Text
bot_command = Maybe Text
bot_command_
    }
      = String
"RichTextBotCommand"
        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
"bot_command" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
bot_command_
        ]
  shortShow RichTextFixed
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = String
"RichTextFixed"
        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_
        ]
  shortShow RichTextMentionName
    { _text :: RichText -> Maybe RichText
_text   = Maybe RichText
_text_
    , user_id :: RichText -> Maybe Int
user_id = Maybe Int
user_id_
    }
      = String
"RichTextMentionName"
        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
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        ]
  shortShow RichTextUrl
    { _text :: RichText -> Maybe RichText
_text     = Maybe RichText
_text_
    , url :: RichText -> Maybe Text
url       = Maybe Text
url_
    , is_cached :: RichText -> Maybe Bool
is_cached = Maybe Bool
is_cached_
    }
      = String
"RichTextUrl"
        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
"url"       String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        , String
"is_cached" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_cached_
        ]
  shortShow RichTextEmailAddress
    { _text :: RichText -> Maybe RichText
_text         = Maybe RichText
_text_
    , email_address :: RichText -> Maybe Text
email_address = Maybe Text
email_address_
    }
      = String
"RichTextEmailAddress"
        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
"email_address" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
email_address_
        ]
  shortShow RichTextBankCardNumber
    { _text :: RichText -> Maybe RichText
_text            = Maybe RichText
_text_
    , bank_card_number :: RichText -> Maybe Text
bank_card_number = Maybe Text
bank_card_number_
    }
      = String
"RichTextBankCardNumber"
        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
"bank_card_number" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
bank_card_number_
        ]
  shortShow RichTextSubscript
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = String
"RichTextSubscript"
        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_
        ]
  shortShow RichTextSuperscript
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = String
"RichTextSuperscript"
        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_
        ]
  shortShow RichTextMarked
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = String
"RichTextMarked"
        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_
        ]
  shortShow RichTextPhoneNumber
    { _text :: RichText -> Maybe RichText
_text        = Maybe RichText
_text_
    , phone_number :: RichText -> Maybe Text
phone_number = Maybe Text
phone_number_
    }
      = String
"RichTextPhoneNumber"
        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
"phone_number" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
phone_number_
        ]
  shortShow RichTextCustomEmoji
    { custom_emoji_id :: RichText -> Maybe Int
custom_emoji_id  = Maybe Int
custom_emoji_id_
    , alternative_text :: RichText -> Maybe Text
alternative_text = Maybe Text
alternative_text_
    }
      = String
"RichTextCustomEmoji"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"custom_emoji_id"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
custom_emoji_id_
        , String
"alternative_text" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
alternative_text_
        ]
  shortShow RichTextIcon
    { document :: RichText -> Maybe Document
document = Maybe Document
document_
    , width :: RichText -> Maybe Int
width    = Maybe Int
width_
    , height :: RichText -> Maybe Int
height   = Maybe Int
height_
    }
      = String
"RichTextIcon"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"document" String -> Maybe Document -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Document
document_
        , 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_
        ]
  shortShow RichTextMathematicalExpression
    { expression :: RichText -> Maybe Text
expression = Maybe Text
expression_
    }
      = String
"RichTextMathematicalExpression"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"expression" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
expression_
        ]
  shortShow RichTextReference
    { name :: RichText -> Maybe Text
name  = Maybe Text
name_
    , _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = String
"RichTextReference"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"name"  String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
name_
        , String
"_text" String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
_text_
        ]
  shortShow RichTextReferenceLink
    { _text :: RichText -> Maybe RichText
_text          = Maybe RichText
_text_
    , reference_name :: RichText -> Maybe Text
reference_name = Maybe Text
reference_name_
    , url :: RichText -> Maybe Text
url            = Maybe Text
url_
    }
      = String
"RichTextReferenceLink"
        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
"reference_name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
reference_name_
        , String
"url"            String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        ]
  shortShow RichTextAnchor
    { name :: RichText -> Maybe Text
name = Maybe Text
name_
    }
      = String
"RichTextAnchor"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
name_
        ]
  shortShow RichTextAnchorLink
    { _text :: RichText -> Maybe RichText
_text       = Maybe RichText
_text_
    , anchor_name :: RichText -> Maybe Text
anchor_name = Maybe Text
anchor_name_
    , url :: RichText -> Maybe Text
url         = Maybe Text
url_
    }
      = String
"RichTextAnchorLink"
        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
"anchor_name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
anchor_name_
        , String
"url"         String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        ]
  shortShow RichTexts
    { texts :: RichText -> Maybe [RichText]
texts = Maybe [RichText]
texts_
    }
      = String
"RichTexts"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"texts" String -> Maybe [RichText] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [RichText]
texts_
        ]

instance AT.FromJSON RichText where
  parseJSON :: Value -> Parser RichText
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
"richTextPlain"                  -> Value -> Parser RichText
parseRichTextPlain Value
v
      String
"richTextBold"                   -> Value -> Parser RichText
parseRichTextBold Value
v
      String
"richTextItalic"                 -> Value -> Parser RichText
parseRichTextItalic Value
v
      String
"richTextUnderline"              -> Value -> Parser RichText
parseRichTextUnderline Value
v
      String
"richTextStrikethrough"          -> Value -> Parser RichText
parseRichTextStrikethrough Value
v
      String
"richTextSpoiler"                -> Value -> Parser RichText
parseRichTextSpoiler Value
v
      String
"richTextDateTime"               -> Value -> Parser RichText
parseRichTextDateTime Value
v
      String
"richTextMention"                -> Value -> Parser RichText
parseRichTextMention Value
v
      String
"richTextHashtag"                -> Value -> Parser RichText
parseRichTextHashtag Value
v
      String
"richTextCashtag"                -> Value -> Parser RichText
parseRichTextCashtag Value
v
      String
"richTextBotCommand"             -> Value -> Parser RichText
parseRichTextBotCommand Value
v
      String
"richTextFixed"                  -> Value -> Parser RichText
parseRichTextFixed Value
v
      String
"richTextMentionName"            -> Value -> Parser RichText
parseRichTextMentionName Value
v
      String
"richTextUrl"                    -> Value -> Parser RichText
parseRichTextUrl Value
v
      String
"richTextEmailAddress"           -> Value -> Parser RichText
parseRichTextEmailAddress Value
v
      String
"richTextBankCardNumber"         -> Value -> Parser RichText
parseRichTextBankCardNumber Value
v
      String
"richTextSubscript"              -> Value -> Parser RichText
parseRichTextSubscript Value
v
      String
"richTextSuperscript"            -> Value -> Parser RichText
parseRichTextSuperscript Value
v
      String
"richTextMarked"                 -> Value -> Parser RichText
parseRichTextMarked Value
v
      String
"richTextPhoneNumber"            -> Value -> Parser RichText
parseRichTextPhoneNumber Value
v
      String
"richTextCustomEmoji"            -> Value -> Parser RichText
parseRichTextCustomEmoji Value
v
      String
"richTextIcon"                   -> Value -> Parser RichText
parseRichTextIcon Value
v
      String
"richTextMathematicalExpression" -> Value -> Parser RichText
parseRichTextMathematicalExpression Value
v
      String
"richTextReference"              -> Value -> Parser RichText
parseRichTextReference Value
v
      String
"richTextReferenceLink"          -> Value -> Parser RichText
parseRichTextReferenceLink Value
v
      String
"richTextAnchor"                 -> Value -> Parser RichText
parseRichTextAnchor Value
v
      String
"richTextAnchorLink"             -> Value -> Parser RichText
parseRichTextAnchorLink Value
v
      String
"richTexts"                      -> Value -> Parser RichText
parseRichTexts Value
v
      String
_                                -> Parser RichText
forall a. Monoid a => a
mempty
    
    where
      parseRichTextPlain :: A.Value -> AT.Parser RichText
      parseRichTextPlain :: Value -> Parser RichText
parseRichTextPlain = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextPlain" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
text_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"text"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextPlain
          { text :: Maybe Text
text = Maybe Text
text_
          }
      parseRichTextBold :: A.Value -> AT.Parser RichText
      parseRichTextBold :: Value -> Parser RichText
parseRichTextBold = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextBold" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextBold
          { _text :: Maybe RichText
_text = Maybe RichText
_text_
          }
      parseRichTextItalic :: A.Value -> AT.Parser RichText
      parseRichTextItalic :: Value -> Parser RichText
parseRichTextItalic = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextItalic" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextItalic
          { _text :: Maybe RichText
_text = Maybe RichText
_text_
          }
      parseRichTextUnderline :: A.Value -> AT.Parser RichText
      parseRichTextUnderline :: Value -> Parser RichText
parseRichTextUnderline = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextUnderline" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextUnderline
          { _text :: Maybe RichText
_text = Maybe RichText
_text_
          }
      parseRichTextStrikethrough :: A.Value -> AT.Parser RichText
      parseRichTextStrikethrough :: Value -> Parser RichText
parseRichTextStrikethrough = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextStrikethrough" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextStrikethrough
          { _text :: Maybe RichText
_text = Maybe RichText
_text_
          }
      parseRichTextSpoiler :: A.Value -> AT.Parser RichText
      parseRichTextSpoiler :: Value -> Parser RichText
parseRichTextSpoiler = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextSpoiler" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextSpoiler
          { _text :: Maybe RichText
_text = Maybe RichText
_text_
          }
      parseRichTextDateTime :: A.Value -> AT.Parser RichText
      parseRichTextDateTime :: Value -> Parser RichText
parseRichTextDateTime = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextDateTime" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Int
unix_time_       <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"unix_time"
        Maybe DateTimeFormattingType
formatting_type_ <- Object
o Object -> Key -> Parser (Maybe DateTimeFormattingType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"formatting_type"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextDateTime
          { _text :: Maybe RichText
_text           = Maybe RichText
_text_
          , unix_time :: Maybe Int
unix_time       = Maybe Int
unix_time_
          , formatting_type :: Maybe DateTimeFormattingType
formatting_type = Maybe DateTimeFormattingType
formatting_type_
          }
      parseRichTextMention :: A.Value -> AT.Parser RichText
      parseRichTextMention :: Value -> Parser RichText
parseRichTextMention = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextMention" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Text
username_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"username"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextMention
          { _text :: Maybe RichText
_text    = Maybe RichText
_text_
          , username :: Maybe Text
username = Maybe Text
username_
          }
      parseRichTextHashtag :: A.Value -> AT.Parser RichText
      parseRichTextHashtag :: Value -> Parser RichText
parseRichTextHashtag = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextHashtag" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Text
hashtag_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"hashtag"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextHashtag
          { _text :: Maybe RichText
_text   = Maybe RichText
_text_
          , hashtag :: Maybe Text
hashtag = Maybe Text
hashtag_
          }
      parseRichTextCashtag :: A.Value -> AT.Parser RichText
      parseRichTextCashtag :: Value -> Parser RichText
parseRichTextCashtag = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextCashtag" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Text
cashtag_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"cashtag"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextCashtag
          { _text :: Maybe RichText
_text   = Maybe RichText
_text_
          , cashtag :: Maybe Text
cashtag = Maybe Text
cashtag_
          }
      parseRichTextBotCommand :: A.Value -> AT.Parser RichText
      parseRichTextBotCommand :: Value -> Parser RichText
parseRichTextBotCommand = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextBotCommand" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Text
bot_command_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"bot_command"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextBotCommand
          { _text :: Maybe RichText
_text       = Maybe RichText
_text_
          , bot_command :: Maybe Text
bot_command = Maybe Text
bot_command_
          }
      parseRichTextFixed :: A.Value -> AT.Parser RichText
      parseRichTextFixed :: Value -> Parser RichText
parseRichTextFixed = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextFixed" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextFixed
          { _text :: Maybe RichText
_text = Maybe RichText
_text_
          }
      parseRichTextMentionName :: A.Value -> AT.Parser RichText
      parseRichTextMentionName :: Value -> Parser RichText
parseRichTextMentionName = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextMentionName" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Int
user_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextMentionName
          { _text :: Maybe RichText
_text   = Maybe RichText
_text_
          , user_id :: Maybe Int
user_id = Maybe Int
user_id_
          }
      parseRichTextUrl :: A.Value -> AT.Parser RichText
      parseRichTextUrl :: Value -> Parser RichText
parseRichTextUrl = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextUrl" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Text
url_       <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        Maybe Bool
is_cached_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_cached"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextUrl
          { _text :: Maybe RichText
_text     = Maybe RichText
_text_
          , url :: Maybe Text
url       = Maybe Text
url_
          , is_cached :: Maybe Bool
is_cached = Maybe Bool
is_cached_
          }
      parseRichTextEmailAddress :: A.Value -> AT.Parser RichText
      parseRichTextEmailAddress :: Value -> Parser RichText
parseRichTextEmailAddress = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextEmailAddress" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Text
email_address_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"email_address"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextEmailAddress
          { _text :: Maybe RichText
_text         = Maybe RichText
_text_
          , email_address :: Maybe Text
email_address = Maybe Text
email_address_
          }
      parseRichTextBankCardNumber :: A.Value -> AT.Parser RichText
      parseRichTextBankCardNumber :: Value -> Parser RichText
parseRichTextBankCardNumber = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextBankCardNumber" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Text
bank_card_number_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"bank_card_number"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextBankCardNumber
          { _text :: Maybe RichText
_text            = Maybe RichText
_text_
          , bank_card_number :: Maybe Text
bank_card_number = Maybe Text
bank_card_number_
          }
      parseRichTextSubscript :: A.Value -> AT.Parser RichText
      parseRichTextSubscript :: Value -> Parser RichText
parseRichTextSubscript = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextSubscript" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextSubscript
          { _text :: Maybe RichText
_text = Maybe RichText
_text_
          }
      parseRichTextSuperscript :: A.Value -> AT.Parser RichText
      parseRichTextSuperscript :: Value -> Parser RichText
parseRichTextSuperscript = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextSuperscript" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextSuperscript
          { _text :: Maybe RichText
_text = Maybe RichText
_text_
          }
      parseRichTextMarked :: A.Value -> AT.Parser RichText
      parseRichTextMarked :: Value -> Parser RichText
parseRichTextMarked = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextMarked" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextMarked
          { _text :: Maybe RichText
_text = Maybe RichText
_text_
          }
      parseRichTextPhoneNumber :: A.Value -> AT.Parser RichText
      parseRichTextPhoneNumber :: Value -> Parser RichText
parseRichTextPhoneNumber = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextPhoneNumber" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Text
phone_number_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"phone_number"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextPhoneNumber
          { _text :: Maybe RichText
_text        = Maybe RichText
_text_
          , phone_number :: Maybe Text
phone_number = Maybe Text
phone_number_
          }
      parseRichTextCustomEmoji :: A.Value -> AT.Parser RichText
      parseRichTextCustomEmoji :: Value -> Parser RichText
parseRichTextCustomEmoji = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextCustomEmoji" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
custom_emoji_id_  <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"custom_emoji_id"
        Maybe Text
alternative_text_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"alternative_text"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextCustomEmoji
          { custom_emoji_id :: Maybe Int
custom_emoji_id  = Maybe Int
custom_emoji_id_
          , alternative_text :: Maybe Text
alternative_text = Maybe Text
alternative_text_
          }
      parseRichTextIcon :: A.Value -> AT.Parser RichText
      parseRichTextIcon :: Value -> Parser RichText
parseRichTextIcon = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextIcon" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Document
document_ <- Object
o Object -> Key -> Parser (Maybe Document)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"document"
        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"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextIcon
          { document :: Maybe Document
document = Maybe Document
document_
          , width :: Maybe Int
width    = Maybe Int
width_
          , height :: Maybe Int
height   = Maybe Int
height_
          }
      parseRichTextMathematicalExpression :: A.Value -> AT.Parser RichText
      parseRichTextMathematicalExpression :: Value -> Parser RichText
parseRichTextMathematicalExpression = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextMathematicalExpression" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
expression_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"expression"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextMathematicalExpression
          { expression :: Maybe Text
expression = Maybe Text
expression_
          }
      parseRichTextReference :: A.Value -> AT.Parser RichText
      parseRichTextReference :: Value -> Parser RichText
parseRichTextReference = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextReference" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
name_  <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"name"
        Maybe RichText
_text_ <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"text"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextReference
          { name :: Maybe Text
name  = Maybe Text
name_
          , _text :: Maybe RichText
_text = Maybe RichText
_text_
          }
      parseRichTextReferenceLink :: A.Value -> AT.Parser RichText
      parseRichTextReferenceLink :: Value -> Parser RichText
parseRichTextReferenceLink = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextReferenceLink" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Text
reference_name_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"reference_name"
        Maybe Text
url_            <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextReferenceLink
          { _text :: Maybe RichText
_text          = Maybe RichText
_text_
          , reference_name :: Maybe Text
reference_name = Maybe Text
reference_name_
          , url :: Maybe Text
url            = Maybe Text
url_
          }
      parseRichTextAnchor :: A.Value -> AT.Parser RichText
      parseRichTextAnchor :: Value -> Parser RichText
parseRichTextAnchor = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextAnchor" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
name_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"name"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextAnchor
          { name :: Maybe Text
name = Maybe Text
name_
          }
      parseRichTextAnchorLink :: A.Value -> AT.Parser RichText
      parseRichTextAnchorLink :: Value -> Parser RichText
parseRichTextAnchorLink = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTextAnchorLink" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
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 Text
anchor_name_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"anchor_name"
        Maybe Text
url_         <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTextAnchorLink
          { _text :: Maybe RichText
_text       = Maybe RichText
_text_
          , anchor_name :: Maybe Text
anchor_name = Maybe Text
anchor_name_
          , url :: Maybe Text
url         = Maybe Text
url_
          }
      parseRichTexts :: A.Value -> AT.Parser RichText
      parseRichTexts :: Value -> Parser RichText
parseRichTexts = String -> (Object -> Parser RichText) -> Value -> Parser RichText
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"RichTexts" ((Object -> Parser RichText) -> Value -> Parser RichText)
-> (Object -> Parser RichText) -> Value -> Parser RichText
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe [RichText]
texts_ <- Object
o Object -> Key -> Parser (Maybe [RichText])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"texts"
        RichText -> Parser RichText
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RichText -> Parser RichText) -> RichText -> Parser RichText
forall a b. (a -> b) -> a -> b
$ RichTexts
          { texts :: Maybe [RichText]
texts = Maybe [RichText]
texts_
          }
  parseJSON Value
_ = Parser RichText
forall a. Monoid a => a
mempty

instance AT.ToJSON RichText where
  toJSON :: RichText -> Value
toJSON RichTextPlain
    { text :: RichText -> Maybe Text
text = Maybe Text
text_
    }
      = [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
"richTextPlain"
        , Key
"text"  Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
text_
        ]
  toJSON RichTextBold
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = [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
"richTextBold"
        , Key
"text"  Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        ]
  toJSON RichTextItalic
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = [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
"richTextItalic"
        , Key
"text"  Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        ]
  toJSON RichTextUnderline
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = [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
"richTextUnderline"
        , Key
"text"  Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        ]
  toJSON RichTextStrikethrough
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = [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
"richTextStrikethrough"
        , Key
"text"  Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        ]
  toJSON RichTextSpoiler
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = [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
"richTextSpoiler"
        , Key
"text"  Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        ]
  toJSON RichTextDateTime
    { _text :: RichText -> Maybe RichText
_text           = Maybe RichText
_text_
    , unix_time :: RichText -> Maybe Int
unix_time       = Maybe Int
unix_time_
    , formatting_type :: RichText -> Maybe DateTimeFormattingType
formatting_type = Maybe DateTimeFormattingType
formatting_type_
    }
      = [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
"richTextDateTime"
        , Key
"text"            Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"unix_time"       Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
unix_time_
        , Key
"formatting_type" Key -> Maybe DateTimeFormattingType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe DateTimeFormattingType
formatting_type_
        ]
  toJSON RichTextMention
    { _text :: RichText -> Maybe RichText
_text    = Maybe RichText
_text_
    , username :: RichText -> Maybe Text
username = Maybe Text
username_
    }
      = [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
"richTextMention"
        , Key
"text"     Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"username" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
username_
        ]
  toJSON RichTextHashtag
    { _text :: RichText -> Maybe RichText
_text   = Maybe RichText
_text_
    , hashtag :: RichText -> Maybe Text
hashtag = Maybe Text
hashtag_
    }
      = [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
"richTextHashtag"
        , Key
"text"    Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"hashtag" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
hashtag_
        ]
  toJSON RichTextCashtag
    { _text :: RichText -> Maybe RichText
_text   = Maybe RichText
_text_
    , cashtag :: RichText -> Maybe Text
cashtag = Maybe Text
cashtag_
    }
      = [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
"richTextCashtag"
        , Key
"text"    Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"cashtag" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
cashtag_
        ]
  toJSON RichTextBotCommand
    { _text :: RichText -> Maybe RichText
_text       = Maybe RichText
_text_
    , bot_command :: RichText -> Maybe Text
bot_command = Maybe Text
bot_command_
    }
      = [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
"richTextBotCommand"
        , Key
"text"        Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"bot_command" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
bot_command_
        ]
  toJSON RichTextFixed
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = [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
"richTextFixed"
        , Key
"text"  Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        ]
  toJSON RichTextMentionName
    { _text :: RichText -> Maybe RichText
_text   = Maybe RichText
_text_
    , user_id :: RichText -> Maybe Int
user_id = Maybe Int
user_id_
    }
      = [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
"richTextMentionName"
        , Key
"text"    Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"user_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
user_id_
        ]
  toJSON RichTextUrl
    { _text :: RichText -> Maybe RichText
_text     = Maybe RichText
_text_
    , url :: RichText -> Maybe Text
url       = Maybe Text
url_
    , is_cached :: RichText -> Maybe Bool
is_cached = Maybe Bool
is_cached_
    }
      = [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
"richTextUrl"
        , Key
"text"      Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"url"       Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
url_
        , Key
"is_cached" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_cached_
        ]
  toJSON RichTextEmailAddress
    { _text :: RichText -> Maybe RichText
_text         = Maybe RichText
_text_
    , email_address :: RichText -> Maybe Text
email_address = Maybe Text
email_address_
    }
      = [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
"richTextEmailAddress"
        , Key
"text"          Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"email_address" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
email_address_
        ]
  toJSON RichTextBankCardNumber
    { _text :: RichText -> Maybe RichText
_text            = Maybe RichText
_text_
    , bank_card_number :: RichText -> Maybe Text
bank_card_number = Maybe Text
bank_card_number_
    }
      = [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
"richTextBankCardNumber"
        , Key
"text"             Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"bank_card_number" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
bank_card_number_
        ]
  toJSON RichTextSubscript
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = [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
"richTextSubscript"
        , Key
"text"  Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        ]
  toJSON RichTextSuperscript
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = [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
"richTextSuperscript"
        , Key
"text"  Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        ]
  toJSON RichTextMarked
    { _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = [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
"richTextMarked"
        , Key
"text"  Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        ]
  toJSON RichTextPhoneNumber
    { _text :: RichText -> Maybe RichText
_text        = Maybe RichText
_text_
    , phone_number :: RichText -> Maybe Text
phone_number = Maybe Text
phone_number_
    }
      = [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
"richTextPhoneNumber"
        , Key
"text"         Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"phone_number" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
phone_number_
        ]
  toJSON RichTextCustomEmoji
    { custom_emoji_id :: RichText -> Maybe Int
custom_emoji_id  = Maybe Int
custom_emoji_id_
    , alternative_text :: RichText -> Maybe Text
alternative_text = Maybe Text
alternative_text_
    }
      = [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
"richTextCustomEmoji"
        , Key
"custom_emoji_id"  Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64  Maybe Int
custom_emoji_id_
        , Key
"alternative_text" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
alternative_text_
        ]
  toJSON RichTextIcon
    { document :: RichText -> Maybe Document
document = Maybe Document
document_
    , width :: RichText -> Maybe Int
width    = Maybe Int
width_
    , height :: RichText -> Maybe Int
height   = Maybe Int
height_
    }
      = [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
"richTextIcon"
        , Key
"document" Key -> Maybe Document -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Document
document_
        , Key
"width"    Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
width_
        , Key
"height"   Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
height_
        ]
  toJSON RichTextMathematicalExpression
    { expression :: RichText -> Maybe Text
expression = Maybe Text
expression_
    }
      = [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
"richTextMathematicalExpression"
        , Key
"expression" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
expression_
        ]
  toJSON RichTextReference
    { name :: RichText -> Maybe Text
name  = Maybe Text
name_
    , _text :: RichText -> Maybe RichText
_text = Maybe RichText
_text_
    }
      = [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
"richTextReference"
        , Key
"name"  Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
name_
        , Key
"text"  Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        ]
  toJSON RichTextReferenceLink
    { _text :: RichText -> Maybe RichText
_text          = Maybe RichText
_text_
    , reference_name :: RichText -> Maybe Text
reference_name = Maybe Text
reference_name_
    , url :: RichText -> Maybe Text
url            = Maybe Text
url_
    }
      = [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
"richTextReferenceLink"
        , Key
"text"           Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"reference_name" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
reference_name_
        , Key
"url"            Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
url_
        ]
  toJSON RichTextAnchor
    { name :: RichText -> Maybe Text
name = Maybe Text
name_
    }
      = [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
"richTextAnchor"
        , Key
"name"  Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
name_
        ]
  toJSON RichTextAnchorLink
    { _text :: RichText -> Maybe RichText
_text       = Maybe RichText
_text_
    , anchor_name :: RichText -> Maybe Text
anchor_name = Maybe Text
anchor_name_
    , url :: RichText -> Maybe Text
url         = Maybe Text
url_
    }
      = [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
"richTextAnchorLink"
        , Key
"text"        Key -> Maybe RichText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe RichText
_text_
        , Key
"anchor_name" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
anchor_name_
        , Key
"url"         Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
url_
        ]
  toJSON RichTexts
    { texts :: RichText -> Maybe [RichText]
texts = Maybe [RichText]
texts_
    }
      = [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
"richTexts"
        , Key
"texts" Key -> Maybe [RichText] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [RichText]
texts_
        ]