module TD.Data.LinkPreviewType
  (LinkPreviewType(..)) 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.LinkPreviewAlbumMedia as LinkPreviewAlbumMedia
import qualified Data.Text as T
import qualified TD.Data.Animation as Animation
import qualified TD.Data.Photo as Photo
import qualified TD.Data.Audio as Audio
import qualified TD.Data.Document as Document
import qualified TD.Data.BackgroundType as BackgroundType
import qualified TD.Data.ChatPhoto as ChatPhoto
import qualified TD.Data.InviteLinkChatType as InviteLinkChatType
import qualified TD.Data.Sticker as Sticker
import qualified TD.Data.ThemeSettings as ThemeSettings
import qualified TD.Data.Video as Video
import qualified TD.Data.VideoNote as VideoNote
import qualified TD.Data.VoiceNote as VoiceNote

-- | Describes type of link preview
data LinkPreviewType
  = LinkPreviewTypeAlbum -- ^ The link is a link to a media album consisting of photos and videos
    { LinkPreviewType -> Maybe [LinkPreviewAlbumMedia]
media   :: Maybe [LinkPreviewAlbumMedia.LinkPreviewAlbumMedia] -- ^ The list of album media
    , LinkPreviewType -> Maybe Text
caption :: Maybe T.Text                                        -- ^ Album caption
    }
  | LinkPreviewTypeAnimation -- ^ The link is a link to an animation
    { LinkPreviewType -> Maybe Animation
animation :: Maybe Animation.Animation -- ^ The animation
    }
  | LinkPreviewTypeApp -- ^ The link is a link to an app at App Store or Google Play
    { LinkPreviewType -> Maybe Photo
photo :: Maybe Photo.Photo -- ^ Photo for the app
    }
  | LinkPreviewTypeArticle -- ^ The link is a link to a web site
    { photo :: Maybe Photo.Photo -- ^ Article's main photo; may be null
    }
  | LinkPreviewTypeAudio -- ^ The link is a link to an audio
    { LinkPreviewType -> Maybe Audio
audio :: Maybe Audio.Audio -- ^ The audio description
    }
  | LinkPreviewTypeBackground -- ^ The link is a link to a background. Link preview title and description are available only for filled backgrounds
    { LinkPreviewType -> Maybe Document
document        :: Maybe Document.Document             -- ^ Document with the background; may be null for filled backgrounds
    , LinkPreviewType -> Maybe BackgroundType
background_type :: Maybe BackgroundType.BackgroundType -- ^ Type of the background; may be null if unknown
    }
  | LinkPreviewTypeChannelBoost -- ^ The link is a link to boost a channel chat
    { LinkPreviewType -> Maybe ChatPhoto
_photo :: Maybe ChatPhoto.ChatPhoto -- ^ Photo of the chat; may be null
    }
  | LinkPreviewTypeChat -- ^ The link is a link to a chat
    { LinkPreviewType -> Maybe InviteLinkChatType
_type                :: Maybe InviteLinkChatType.InviteLinkChatType -- ^ Type of the chat
    , _photo               :: Maybe ChatPhoto.ChatPhoto                   -- ^ Photo of the chat; may be null
    , LinkPreviewType -> Maybe Bool
creates_join_request :: Maybe Bool                                  -- ^ True, if the link only creates join request
    }
  | LinkPreviewTypeDocument -- ^ The link is a link to a general file
    { document :: Maybe Document.Document -- ^ The document description
    }
  | LinkPreviewTypeEmbeddedAnimationPlayer -- ^ The link is a link to an animation player
    { LinkPreviewType -> Maybe Text
url       :: Maybe T.Text      -- ^ URL of the external animation player
    , LinkPreviewType -> Maybe Photo
thumbnail :: Maybe Photo.Photo -- ^ Thumbnail of the animation; may be null if unknown
    , LinkPreviewType -> Maybe Int
duration  :: Maybe Int         -- ^ Duration of the animation, in seconds
    , LinkPreviewType -> Maybe Int
width     :: Maybe Int         -- ^ Expected width of the embedded player
    , LinkPreviewType -> Maybe Int
height    :: Maybe Int         -- ^ Expected height of the embedded player
    }
  | LinkPreviewTypeEmbeddedAudioPlayer -- ^ The link is a link to an audio player
    { url       :: Maybe T.Text      -- ^ URL of the external audio player
    , thumbnail :: Maybe Photo.Photo -- ^ Thumbnail of the audio; may be null if unknown
    , duration  :: Maybe Int         -- ^ Duration of the audio, in seconds
    , width     :: Maybe Int         -- ^ Expected width of the embedded player
    , height    :: Maybe Int         -- ^ Expected height of the embedded player
    }
  | LinkPreviewTypeEmbeddedVideoPlayer -- ^ The link is a link to a video player
    { url       :: Maybe T.Text      -- ^ URL of the external video player
    , thumbnail :: Maybe Photo.Photo -- ^ Thumbnail of the video; may be null if unknown
    , duration  :: Maybe Int         -- ^ Duration of the video, in seconds
    , width     :: Maybe Int         -- ^ Expected width of the embedded player
    , height    :: Maybe Int         -- ^ Expected height of the embedded player
    }
  | LinkPreviewTypeExternalAudio -- ^ The link is a link to an audio file
    { url       :: Maybe T.Text -- ^ URL of the audio file
    , LinkPreviewType -> Maybe Text
mime_type :: Maybe T.Text -- ^ MIME type of the audio file
    , duration  :: Maybe Int    -- ^ Duration of the audio, in seconds; 0 if unknown
    }
  | LinkPreviewTypeExternalVideo -- ^ The link is a link to a video file
    { url       :: Maybe T.Text -- ^ URL of the video file
    , mime_type :: Maybe T.Text -- ^ MIME type of the video file
    , width     :: Maybe Int    -- ^ Expected width of the video preview; 0 if unknown
    , height    :: Maybe Int    -- ^ Expected height of the video preview; 0 if unknown
    , duration  :: Maybe Int    -- ^ Duration of the video, in seconds; 0 if unknown
    }
  | LinkPreviewTypeInvoice -- ^ The link is a link to an invoice
  | LinkPreviewTypeMessage -- ^ The link is a link to a text or a poll Telegram message
  | LinkPreviewTypePhoto -- ^ The link is a link to a photo
    { photo :: Maybe Photo.Photo -- ^ The photo
    }
  | LinkPreviewTypePremiumGiftCode -- ^ The link is a link to a Telegram Premium gift code
  | LinkPreviewTypeShareableChatFolder -- ^ The link is a link to a shareable chat folder
  | LinkPreviewTypeSticker -- ^ The link is a link to a sticker
    { LinkPreviewType -> Maybe Sticker
sticker :: Maybe Sticker.Sticker -- ^ The sticker. It can be an arbitrary WEBP image and can have dimensions bigger than 512
    }
  | LinkPreviewTypeStickerSet -- ^ The link is a link to a sticker set
    { LinkPreviewType -> Maybe [Sticker]
stickers :: Maybe [Sticker.Sticker] -- ^ Up to 4 stickers from the sticker set
    }
  | LinkPreviewTypeStory -- ^ The link is a link to a story. Link preview description is unavailable
    { LinkPreviewType -> Maybe Int
story_sender_chat_id :: Maybe Int -- ^ The identifier of the chat that posted the story
    , LinkPreviewType -> Maybe Int
story_id             :: Maybe Int -- ^ Story identifier
    }
  | LinkPreviewTypeSupergroupBoost -- ^ The link is a link to boost a supergroup chat
    { _photo :: Maybe ChatPhoto.ChatPhoto -- ^ Photo of the chat; may be null
    }
  | LinkPreviewTypeTheme -- ^ The link is a link to a cloud theme. TDLib has no theme support yet
    { LinkPreviewType -> Maybe [Document]
documents :: Maybe [Document.Document]         -- ^ The list of files with theme description
    , LinkPreviewType -> Maybe ThemeSettings
settings  :: Maybe ThemeSettings.ThemeSettings -- ^ Settings for the cloud theme; may be null if unknown
    }
  | LinkPreviewTypeUnsupported -- ^ The link preview type is unsupported yet
  | LinkPreviewTypeUser -- ^ The link is a link to a user
    { _photo :: Maybe ChatPhoto.ChatPhoto -- ^ Photo of the user; may be null if none
    , LinkPreviewType -> Maybe Bool
is_bot :: Maybe Bool                -- ^ True, if the user is a bot
    }
  | LinkPreviewTypeVideo -- ^ The link is a link to a video
    { LinkPreviewType -> Maybe Video
video :: Maybe Video.Video -- ^ The video description
    }
  | LinkPreviewTypeVideoChat -- ^ The link is a link to a video chat
    { _photo         :: Maybe ChatPhoto.ChatPhoto -- ^ Photo of the chat with the video chat; may be null if none
    , LinkPreviewType -> Maybe Bool
is_live_stream :: Maybe Bool                -- ^ True, if the video chat is expected to be a live stream in a channel or a broadcast group
    }
  | LinkPreviewTypeVideoNote -- ^ The link is a link to a video note message
    { LinkPreviewType -> Maybe VideoNote
video_note :: Maybe VideoNote.VideoNote -- ^ The video note
    }
  | LinkPreviewTypeVoiceNote -- ^ The link is a link to a voice note message
    { LinkPreviewType -> Maybe VoiceNote
voice_note :: Maybe VoiceNote.VoiceNote -- ^ The voice note
    }
  | LinkPreviewTypeWebApp -- ^ The link is a link to a Web App
    { photo :: Maybe Photo.Photo -- ^ Web App photo; may be null if none
    }
  deriving (LinkPreviewType -> LinkPreviewType -> Bool
(LinkPreviewType -> LinkPreviewType -> Bool)
-> (LinkPreviewType -> LinkPreviewType -> Bool)
-> Eq LinkPreviewType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LinkPreviewType -> LinkPreviewType -> Bool
== :: LinkPreviewType -> LinkPreviewType -> Bool
$c/= :: LinkPreviewType -> LinkPreviewType -> Bool
/= :: LinkPreviewType -> LinkPreviewType -> Bool
Eq, Int -> LinkPreviewType -> ShowS
[LinkPreviewType] -> ShowS
LinkPreviewType -> String
(Int -> LinkPreviewType -> ShowS)
-> (LinkPreviewType -> String)
-> ([LinkPreviewType] -> ShowS)
-> Show LinkPreviewType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LinkPreviewType -> ShowS
showsPrec :: Int -> LinkPreviewType -> ShowS
$cshow :: LinkPreviewType -> String
show :: LinkPreviewType -> String
$cshowList :: [LinkPreviewType] -> ShowS
showList :: [LinkPreviewType] -> ShowS
Show)

instance I.ShortShow LinkPreviewType where
  shortShow :: LinkPreviewType -> String
shortShow LinkPreviewTypeAlbum
    { media :: LinkPreviewType -> Maybe [LinkPreviewAlbumMedia]
media   = Maybe [LinkPreviewAlbumMedia]
media_
    , caption :: LinkPreviewType -> Maybe Text
caption = Maybe Text
caption_
    }
      = String
"LinkPreviewTypeAlbum"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"media"   String -> Maybe [LinkPreviewAlbumMedia] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [LinkPreviewAlbumMedia]
media_
        , String
"caption" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
caption_
        ]
  shortShow LinkPreviewTypeAnimation
    { animation :: LinkPreviewType -> Maybe Animation
animation = Maybe Animation
animation_
    }
      = String
"LinkPreviewTypeAnimation"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"animation" String -> Maybe Animation -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Animation
animation_
        ]
  shortShow LinkPreviewTypeApp
    { photo :: LinkPreviewType -> Maybe Photo
photo = Maybe Photo
photo_
    }
      = String
"LinkPreviewTypeApp"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"photo" String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
photo_
        ]
  shortShow LinkPreviewTypeArticle
    { photo :: LinkPreviewType -> Maybe Photo
photo = Maybe Photo
photo_
    }
      = String
"LinkPreviewTypeArticle"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"photo" String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
photo_
        ]
  shortShow LinkPreviewTypeAudio
    { audio :: LinkPreviewType -> Maybe Audio
audio = Maybe Audio
audio_
    }
      = String
"LinkPreviewTypeAudio"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"audio" String -> Maybe Audio -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Audio
audio_
        ]
  shortShow LinkPreviewTypeBackground
    { document :: LinkPreviewType -> Maybe Document
document        = Maybe Document
document_
    , background_type :: LinkPreviewType -> Maybe BackgroundType
background_type = Maybe BackgroundType
background_type_
    }
      = String
"LinkPreviewTypeBackground"
        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
"background_type" String -> Maybe BackgroundType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BackgroundType
background_type_
        ]
  shortShow LinkPreviewTypeChannelBoost
    { _photo :: LinkPreviewType -> Maybe ChatPhoto
_photo = Maybe ChatPhoto
_photo_
    }
      = String
"LinkPreviewTypeChannelBoost"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"_photo" String -> Maybe ChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhoto
_photo_
        ]
  shortShow LinkPreviewTypeChat
    { _type :: LinkPreviewType -> Maybe InviteLinkChatType
_type                = Maybe InviteLinkChatType
_type_
    , _photo :: LinkPreviewType -> Maybe ChatPhoto
_photo               = Maybe ChatPhoto
_photo_
    , creates_join_request :: LinkPreviewType -> Maybe Bool
creates_join_request = Maybe Bool
creates_join_request_
    }
      = String
"LinkPreviewTypeChat"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"_type"                String -> Maybe InviteLinkChatType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InviteLinkChatType
_type_
        , String
"_photo"               String -> Maybe ChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhoto
_photo_
        , String
"creates_join_request" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
creates_join_request_
        ]
  shortShow LinkPreviewTypeDocument
    { document :: LinkPreviewType -> Maybe Document
document = Maybe Document
document_
    }
      = String
"LinkPreviewTypeDocument"
        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_
        ]
  shortShow LinkPreviewTypeEmbeddedAnimationPlayer
    { url :: LinkPreviewType -> Maybe Text
url       = Maybe Text
url_
    , thumbnail :: LinkPreviewType -> Maybe Photo
thumbnail = Maybe Photo
thumbnail_
    , duration :: LinkPreviewType -> Maybe Int
duration  = Maybe Int
duration_
    , width :: LinkPreviewType -> Maybe Int
width     = Maybe Int
width_
    , height :: LinkPreviewType -> Maybe Int
height    = Maybe Int
height_
    }
      = String
"LinkPreviewTypeEmbeddedAnimationPlayer"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"url"       String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        , String
"thumbnail" String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
thumbnail_
        , String
"duration"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
duration_
        , 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 LinkPreviewTypeEmbeddedAudioPlayer
    { url :: LinkPreviewType -> Maybe Text
url       = Maybe Text
url_
    , thumbnail :: LinkPreviewType -> Maybe Photo
thumbnail = Maybe Photo
thumbnail_
    , duration :: LinkPreviewType -> Maybe Int
duration  = Maybe Int
duration_
    , width :: LinkPreviewType -> Maybe Int
width     = Maybe Int
width_
    , height :: LinkPreviewType -> Maybe Int
height    = Maybe Int
height_
    }
      = String
"LinkPreviewTypeEmbeddedAudioPlayer"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"url"       String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        , String
"thumbnail" String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
thumbnail_
        , String
"duration"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
duration_
        , 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 LinkPreviewTypeEmbeddedVideoPlayer
    { url :: LinkPreviewType -> Maybe Text
url       = Maybe Text
url_
    , thumbnail :: LinkPreviewType -> Maybe Photo
thumbnail = Maybe Photo
thumbnail_
    , duration :: LinkPreviewType -> Maybe Int
duration  = Maybe Int
duration_
    , width :: LinkPreviewType -> Maybe Int
width     = Maybe Int
width_
    , height :: LinkPreviewType -> Maybe Int
height    = Maybe Int
height_
    }
      = String
"LinkPreviewTypeEmbeddedVideoPlayer"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"url"       String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        , String
"thumbnail" String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
thumbnail_
        , String
"duration"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
duration_
        , 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 LinkPreviewTypeExternalAudio
    { url :: LinkPreviewType -> Maybe Text
url       = Maybe Text
url_
    , mime_type :: LinkPreviewType -> Maybe Text
mime_type = Maybe Text
mime_type_
    , duration :: LinkPreviewType -> Maybe Int
duration  = Maybe Int
duration_
    }
      = String
"LinkPreviewTypeExternalAudio"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"url"       String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        , String
"mime_type" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
mime_type_
        , String
"duration"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
duration_
        ]
  shortShow LinkPreviewTypeExternalVideo
    { url :: LinkPreviewType -> Maybe Text
url       = Maybe Text
url_
    , mime_type :: LinkPreviewType -> Maybe Text
mime_type = Maybe Text
mime_type_
    , width :: LinkPreviewType -> Maybe Int
width     = Maybe Int
width_
    , height :: LinkPreviewType -> Maybe Int
height    = Maybe Int
height_
    , duration :: LinkPreviewType -> Maybe Int
duration  = Maybe Int
duration_
    }
      = String
"LinkPreviewTypeExternalVideo"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"url"       String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        , String
"mime_type" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
mime_type_
        , 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
"duration"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
duration_
        ]
  shortShow LinkPreviewType
LinkPreviewTypeInvoice
      = String
"LinkPreviewTypeInvoice"
  shortShow LinkPreviewType
LinkPreviewTypeMessage
      = String
"LinkPreviewTypeMessage"
  shortShow LinkPreviewTypePhoto
    { photo :: LinkPreviewType -> Maybe Photo
photo = Maybe Photo
photo_
    }
      = String
"LinkPreviewTypePhoto"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"photo" String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
photo_
        ]
  shortShow LinkPreviewType
LinkPreviewTypePremiumGiftCode
      = String
"LinkPreviewTypePremiumGiftCode"
  shortShow LinkPreviewType
LinkPreviewTypeShareableChatFolder
      = String
"LinkPreviewTypeShareableChatFolder"
  shortShow LinkPreviewTypeSticker
    { sticker :: LinkPreviewType -> Maybe Sticker
sticker = Maybe Sticker
sticker_
    }
      = String
"LinkPreviewTypeSticker"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"sticker" String -> Maybe Sticker -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Sticker
sticker_
        ]
  shortShow LinkPreviewTypeStickerSet
    { stickers :: LinkPreviewType -> Maybe [Sticker]
stickers = Maybe [Sticker]
stickers_
    }
      = String
"LinkPreviewTypeStickerSet"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"stickers" String -> Maybe [Sticker] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Sticker]
stickers_
        ]
  shortShow LinkPreviewTypeStory
    { story_sender_chat_id :: LinkPreviewType -> Maybe Int
story_sender_chat_id = Maybe Int
story_sender_chat_id_
    , story_id :: LinkPreviewType -> Maybe Int
story_id             = Maybe Int
story_id_
    }
      = String
"LinkPreviewTypeStory"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"story_sender_chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
story_sender_chat_id_
        , String
"story_id"             String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
story_id_
        ]
  shortShow LinkPreviewTypeSupergroupBoost
    { _photo :: LinkPreviewType -> Maybe ChatPhoto
_photo = Maybe ChatPhoto
_photo_
    }
      = String
"LinkPreviewTypeSupergroupBoost"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"_photo" String -> Maybe ChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhoto
_photo_
        ]
  shortShow LinkPreviewTypeTheme
    { documents :: LinkPreviewType -> Maybe [Document]
documents = Maybe [Document]
documents_
    , settings :: LinkPreviewType -> Maybe ThemeSettings
settings  = Maybe ThemeSettings
settings_
    }
      = String
"LinkPreviewTypeTheme"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"documents" String -> Maybe [Document] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Document]
documents_
        , String
"settings"  String -> Maybe ThemeSettings -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ThemeSettings
settings_
        ]
  shortShow LinkPreviewType
LinkPreviewTypeUnsupported
      = String
"LinkPreviewTypeUnsupported"
  shortShow LinkPreviewTypeUser
    { _photo :: LinkPreviewType -> Maybe ChatPhoto
_photo = Maybe ChatPhoto
_photo_
    , is_bot :: LinkPreviewType -> Maybe Bool
is_bot = Maybe Bool
is_bot_
    }
      = String
"LinkPreviewTypeUser"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"_photo" String -> Maybe ChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhoto
_photo_
        , String
"is_bot" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_bot_
        ]
  shortShow LinkPreviewTypeVideo
    { video :: LinkPreviewType -> Maybe Video
video = Maybe Video
video_
    }
      = String
"LinkPreviewTypeVideo"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"video" String -> Maybe Video -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Video
video_
        ]
  shortShow LinkPreviewTypeVideoChat
    { _photo :: LinkPreviewType -> Maybe ChatPhoto
_photo         = Maybe ChatPhoto
_photo_
    , is_live_stream :: LinkPreviewType -> Maybe Bool
is_live_stream = Maybe Bool
is_live_stream_
    }
      = String
"LinkPreviewTypeVideoChat"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"_photo"         String -> Maybe ChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhoto
_photo_
        , String
"is_live_stream" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_live_stream_
        ]
  shortShow LinkPreviewTypeVideoNote
    { video_note :: LinkPreviewType -> Maybe VideoNote
video_note = Maybe VideoNote
video_note_
    }
      = String
"LinkPreviewTypeVideoNote"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"video_note" String -> Maybe VideoNote -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe VideoNote
video_note_
        ]
  shortShow LinkPreviewTypeVoiceNote
    { voice_note :: LinkPreviewType -> Maybe VoiceNote
voice_note = Maybe VoiceNote
voice_note_
    }
      = String
"LinkPreviewTypeVoiceNote"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"voice_note" String -> Maybe VoiceNote -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe VoiceNote
voice_note_
        ]
  shortShow LinkPreviewTypeWebApp
    { photo :: LinkPreviewType -> Maybe Photo
photo = Maybe Photo
photo_
    }
      = String
"LinkPreviewTypeWebApp"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"photo" String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
photo_
        ]

instance AT.FromJSON LinkPreviewType where
  parseJSON :: Value -> Parser LinkPreviewType
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
"linkPreviewTypeAlbum"                   -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeAlbum Value
v
      String
"linkPreviewTypeAnimation"               -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeAnimation Value
v
      String
"linkPreviewTypeApp"                     -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeApp Value
v
      String
"linkPreviewTypeArticle"                 -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeArticle Value
v
      String
"linkPreviewTypeAudio"                   -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeAudio Value
v
      String
"linkPreviewTypeBackground"              -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeBackground Value
v
      String
"linkPreviewTypeChannelBoost"            -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeChannelBoost Value
v
      String
"linkPreviewTypeChat"                    -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeChat Value
v
      String
"linkPreviewTypeDocument"                -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeDocument Value
v
      String
"linkPreviewTypeEmbeddedAnimationPlayer" -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeEmbeddedAnimationPlayer Value
v
      String
"linkPreviewTypeEmbeddedAudioPlayer"     -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeEmbeddedAudioPlayer Value
v
      String
"linkPreviewTypeEmbeddedVideoPlayer"     -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeEmbeddedVideoPlayer Value
v
      String
"linkPreviewTypeExternalAudio"           -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeExternalAudio Value
v
      String
"linkPreviewTypeExternalVideo"           -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeExternalVideo Value
v
      String
"linkPreviewTypeInvoice"                 -> LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure LinkPreviewType
LinkPreviewTypeInvoice
      String
"linkPreviewTypeMessage"                 -> LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure LinkPreviewType
LinkPreviewTypeMessage
      String
"linkPreviewTypePhoto"                   -> Value -> Parser LinkPreviewType
parseLinkPreviewTypePhoto Value
v
      String
"linkPreviewTypePremiumGiftCode"         -> LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure LinkPreviewType
LinkPreviewTypePremiumGiftCode
      String
"linkPreviewTypeShareableChatFolder"     -> LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure LinkPreviewType
LinkPreviewTypeShareableChatFolder
      String
"linkPreviewTypeSticker"                 -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeSticker Value
v
      String
"linkPreviewTypeStickerSet"              -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeStickerSet Value
v
      String
"linkPreviewTypeStory"                   -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeStory Value
v
      String
"linkPreviewTypeSupergroupBoost"         -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeSupergroupBoost Value
v
      String
"linkPreviewTypeTheme"                   -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeTheme Value
v
      String
"linkPreviewTypeUnsupported"             -> LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure LinkPreviewType
LinkPreviewTypeUnsupported
      String
"linkPreviewTypeUser"                    -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeUser Value
v
      String
"linkPreviewTypeVideo"                   -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeVideo Value
v
      String
"linkPreviewTypeVideoChat"               -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeVideoChat Value
v
      String
"linkPreviewTypeVideoNote"               -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeVideoNote Value
v
      String
"linkPreviewTypeVoiceNote"               -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeVoiceNote Value
v
      String
"linkPreviewTypeWebApp"                  -> Value -> Parser LinkPreviewType
parseLinkPreviewTypeWebApp Value
v
      String
_                                        -> Parser LinkPreviewType
forall a. Monoid a => a
mempty
    
    where
      parseLinkPreviewTypeAlbum :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeAlbum :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeAlbum = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeAlbum" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe [LinkPreviewAlbumMedia]
media_   <- Object
o Object -> Key -> Parser (Maybe [LinkPreviewAlbumMedia])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"media"
        Maybe Text
caption_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeAlbum
          { media :: Maybe [LinkPreviewAlbumMedia]
media   = Maybe [LinkPreviewAlbumMedia]
media_
          , caption :: Maybe Text
caption = Maybe Text
caption_
          }
      parseLinkPreviewTypeAnimation :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeAnimation :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeAnimation = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeAnimation" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Animation
animation_ <- Object
o Object -> Key -> Parser (Maybe Animation)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"animation"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeAnimation
          { animation :: Maybe Animation
animation = Maybe Animation
animation_
          }
      parseLinkPreviewTypeApp :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeApp :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeApp = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeApp" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Photo
photo_ <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeApp
          { photo :: Maybe Photo
photo = Maybe Photo
photo_
          }
      parseLinkPreviewTypeArticle :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeArticle :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeArticle = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeArticle" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Photo
photo_ <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeArticle
          { photo :: Maybe Photo
photo = Maybe Photo
photo_
          }
      parseLinkPreviewTypeAudio :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeAudio :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeAudio = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeAudio" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Audio
audio_ <- Object
o Object -> Key -> Parser (Maybe Audio)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"audio"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeAudio
          { audio :: Maybe Audio
audio = Maybe Audio
audio_
          }
      parseLinkPreviewTypeBackground :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeBackground :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeBackground = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeBackground" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
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 BackgroundType
background_type_ <- Object
o Object -> Key -> Parser (Maybe BackgroundType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"background_type"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeBackground
          { document :: Maybe Document
document        = Maybe Document
document_
          , background_type :: Maybe BackgroundType
background_type = Maybe BackgroundType
background_type_
          }
      parseLinkPreviewTypeChannelBoost :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeChannelBoost :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeChannelBoost = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeChannelBoost" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe ChatPhoto
_photo_ <- Object
o Object -> Key -> Parser (Maybe ChatPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeChannelBoost
          { _photo :: Maybe ChatPhoto
_photo = Maybe ChatPhoto
_photo_
          }
      parseLinkPreviewTypeChat :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeChat :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeChat = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeChat" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe InviteLinkChatType
_type_                <- Object
o Object -> Key -> Parser (Maybe InviteLinkChatType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"type"
        Maybe ChatPhoto
_photo_               <- Object
o Object -> Key -> Parser (Maybe ChatPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        Maybe Bool
creates_join_request_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"creates_join_request"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeChat
          { _type :: Maybe InviteLinkChatType
_type                = Maybe InviteLinkChatType
_type_
          , _photo :: Maybe ChatPhoto
_photo               = Maybe ChatPhoto
_photo_
          , creates_join_request :: Maybe Bool
creates_join_request = Maybe Bool
creates_join_request_
          }
      parseLinkPreviewTypeDocument :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeDocument :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeDocument = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeDocument" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
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"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeDocument
          { document :: Maybe Document
document = Maybe Document
document_
          }
      parseLinkPreviewTypeEmbeddedAnimationPlayer :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeEmbeddedAnimationPlayer :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeEmbeddedAnimationPlayer = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeEmbeddedAnimationPlayer" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
url_       <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        Maybe Photo
thumbnail_ <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"thumbnail"
        Maybe Int
duration_  <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"duration"
        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"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeEmbeddedAnimationPlayer
          { url :: Maybe Text
url       = Maybe Text
url_
          , thumbnail :: Maybe Photo
thumbnail = Maybe Photo
thumbnail_
          , duration :: Maybe Int
duration  = Maybe Int
duration_
          , width :: Maybe Int
width     = Maybe Int
width_
          , height :: Maybe Int
height    = Maybe Int
height_
          }
      parseLinkPreviewTypeEmbeddedAudioPlayer :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeEmbeddedAudioPlayer :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeEmbeddedAudioPlayer = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeEmbeddedAudioPlayer" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
url_       <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        Maybe Photo
thumbnail_ <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"thumbnail"
        Maybe Int
duration_  <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"duration"
        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"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeEmbeddedAudioPlayer
          { url :: Maybe Text
url       = Maybe Text
url_
          , thumbnail :: Maybe Photo
thumbnail = Maybe Photo
thumbnail_
          , duration :: Maybe Int
duration  = Maybe Int
duration_
          , width :: Maybe Int
width     = Maybe Int
width_
          , height :: Maybe Int
height    = Maybe Int
height_
          }
      parseLinkPreviewTypeEmbeddedVideoPlayer :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeEmbeddedVideoPlayer :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeEmbeddedVideoPlayer = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeEmbeddedVideoPlayer" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
url_       <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        Maybe Photo
thumbnail_ <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"thumbnail"
        Maybe Int
duration_  <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"duration"
        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"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeEmbeddedVideoPlayer
          { url :: Maybe Text
url       = Maybe Text
url_
          , thumbnail :: Maybe Photo
thumbnail = Maybe Photo
thumbnail_
          , duration :: Maybe Int
duration  = Maybe Int
duration_
          , width :: Maybe Int
width     = Maybe Int
width_
          , height :: Maybe Int
height    = Maybe Int
height_
          }
      parseLinkPreviewTypeExternalAudio :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeExternalAudio :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeExternalAudio = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeExternalAudio" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
url_       <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        Maybe Text
mime_type_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"mime_type"
        Maybe Int
duration_  <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"duration"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeExternalAudio
          { url :: Maybe Text
url       = Maybe Text
url_
          , mime_type :: Maybe Text
mime_type = Maybe Text
mime_type_
          , duration :: Maybe Int
duration  = Maybe Int
duration_
          }
      parseLinkPreviewTypeExternalVideo :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeExternalVideo :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeExternalVideo = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeExternalVideo" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
url_       <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        Maybe Text
mime_type_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"mime_type"
        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 Int
duration_  <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"duration"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeExternalVideo
          { url :: Maybe Text
url       = Maybe Text
url_
          , mime_type :: Maybe Text
mime_type = Maybe Text
mime_type_
          , width :: Maybe Int
width     = Maybe Int
width_
          , height :: Maybe Int
height    = Maybe Int
height_
          , duration :: Maybe Int
duration  = Maybe Int
duration_
          }
      parseLinkPreviewTypePhoto :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypePhoto :: Value -> Parser LinkPreviewType
parseLinkPreviewTypePhoto = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypePhoto" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Photo
photo_ <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypePhoto
          { photo :: Maybe Photo
photo = Maybe Photo
photo_
          }
      parseLinkPreviewTypeSticker :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeSticker :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeSticker = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeSticker" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Sticker
sticker_ <- Object
o Object -> Key -> Parser (Maybe Sticker)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"sticker"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeSticker
          { sticker :: Maybe Sticker
sticker = Maybe Sticker
sticker_
          }
      parseLinkPreviewTypeStickerSet :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeStickerSet :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeStickerSet = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeStickerSet" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe [Sticker]
stickers_ <- Object
o Object -> Key -> Parser (Maybe [Sticker])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"stickers"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeStickerSet
          { stickers :: Maybe [Sticker]
stickers = Maybe [Sticker]
stickers_
          }
      parseLinkPreviewTypeStory :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeStory :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeStory = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeStory" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
story_sender_chat_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"story_sender_chat_id"
        Maybe Int
story_id_             <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"story_id"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeStory
          { story_sender_chat_id :: Maybe Int
story_sender_chat_id = Maybe Int
story_sender_chat_id_
          , story_id :: Maybe Int
story_id             = Maybe Int
story_id_
          }
      parseLinkPreviewTypeSupergroupBoost :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeSupergroupBoost :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeSupergroupBoost = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeSupergroupBoost" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe ChatPhoto
_photo_ <- Object
o Object -> Key -> Parser (Maybe ChatPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeSupergroupBoost
          { _photo :: Maybe ChatPhoto
_photo = Maybe ChatPhoto
_photo_
          }
      parseLinkPreviewTypeTheme :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeTheme :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeTheme = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeTheme" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe [Document]
documents_ <- Object
o Object -> Key -> Parser (Maybe [Document])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"documents"
        Maybe ThemeSettings
settings_  <- Object
o Object -> Key -> Parser (Maybe ThemeSettings)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"settings"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeTheme
          { documents :: Maybe [Document]
documents = Maybe [Document]
documents_
          , settings :: Maybe ThemeSettings
settings  = Maybe ThemeSettings
settings_
          }
      parseLinkPreviewTypeUser :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeUser :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeUser = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeUser" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe ChatPhoto
_photo_ <- Object
o Object -> Key -> Parser (Maybe ChatPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        Maybe Bool
is_bot_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_bot"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeUser
          { _photo :: Maybe ChatPhoto
_photo = Maybe ChatPhoto
_photo_
          , is_bot :: Maybe Bool
is_bot = Maybe Bool
is_bot_
          }
      parseLinkPreviewTypeVideo :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeVideo :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeVideo = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeVideo" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Video
video_ <- Object
o Object -> Key -> Parser (Maybe Video)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"video"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeVideo
          { video :: Maybe Video
video = Maybe Video
video_
          }
      parseLinkPreviewTypeVideoChat :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeVideoChat :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeVideoChat = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeVideoChat" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe ChatPhoto
_photo_         <- Object
o Object -> Key -> Parser (Maybe ChatPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        Maybe Bool
is_live_stream_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_live_stream"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeVideoChat
          { _photo :: Maybe ChatPhoto
_photo         = Maybe ChatPhoto
_photo_
          , is_live_stream :: Maybe Bool
is_live_stream = Maybe Bool
is_live_stream_
          }
      parseLinkPreviewTypeVideoNote :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeVideoNote :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeVideoNote = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeVideoNote" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe VideoNote
video_note_ <- Object
o Object -> Key -> Parser (Maybe VideoNote)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"video_note"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeVideoNote
          { video_note :: Maybe VideoNote
video_note = Maybe VideoNote
video_note_
          }
      parseLinkPreviewTypeVoiceNote :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeVoiceNote :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeVoiceNote = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeVoiceNote" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe VoiceNote
voice_note_ <- Object
o Object -> Key -> Parser (Maybe VoiceNote)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"voice_note"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeVoiceNote
          { voice_note :: Maybe VoiceNote
voice_note = Maybe VoiceNote
voice_note_
          }
      parseLinkPreviewTypeWebApp :: A.Value -> AT.Parser LinkPreviewType
      parseLinkPreviewTypeWebApp :: Value -> Parser LinkPreviewType
parseLinkPreviewTypeWebApp = String
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"LinkPreviewTypeWebApp" ((Object -> Parser LinkPreviewType)
 -> Value -> Parser LinkPreviewType)
-> (Object -> Parser LinkPreviewType)
-> Value
-> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Photo
photo_ <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        LinkPreviewType -> Parser LinkPreviewType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LinkPreviewType -> Parser LinkPreviewType)
-> LinkPreviewType -> Parser LinkPreviewType
forall a b. (a -> b) -> a -> b
$ LinkPreviewTypeWebApp
          { photo :: Maybe Photo
photo = Maybe Photo
photo_
          }
  parseJSON Value
_ = Parser LinkPreviewType
forall a. Monoid a => a
mempty