module TD.Data.InputPollMedia
  (InputPollMedia(..)) 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.InputAnimation as InputAnimation
import qualified TD.Data.InputAudio as InputAudio
import qualified TD.Data.InputDocument as InputDocument
import qualified Data.Text as T
import qualified TD.Data.Location as Location
import qualified TD.Data.InputPhoto as InputPhoto
import qualified TD.Data.InputFile as InputFile
import qualified TD.Data.InputThumbnail as InputThumbnail
import qualified TD.Data.Venue as Venue
import qualified TD.Data.InputVideo as InputVideo

-- | The content of a poll media to send
data InputPollMedia
  = InputPollMediaAnimation -- ^ An animation
    { InputPollMedia -> Maybe InputAnimation
animation :: Maybe InputAnimation.InputAnimation -- ^ The animation to be sent
    }
  | InputPollMediaAudio -- ^ An audio
    { InputPollMedia -> Maybe InputAudio
audio :: Maybe InputAudio.InputAudio -- ^ The audio to be sent
    }
  | InputPollMediaDocument -- ^ A document (general file)
    { InputPollMedia -> Maybe InputDocument
document :: Maybe InputDocument.InputDocument -- ^ The document to be sent
    }
  | InputPollMediaLink -- ^ A link
    { InputPollMedia -> Maybe Text
url :: Maybe T.Text -- ^ URL of the link
    }
  | InputPollMediaLocation -- ^ A location
    { InputPollMedia -> Maybe Location
location :: Maybe Location.Location -- ^ Location to be sent
    }
  | InputPollMediaPhoto -- ^ A photo
    { InputPollMedia -> Maybe InputPhoto
photo :: Maybe InputPhoto.InputPhoto -- ^ Photo to be sent
    }
  | InputPollMediaSticker -- ^ A sticker
    { InputPollMedia -> Maybe InputFile
sticker   :: Maybe InputFile.InputFile           -- ^ Sticker to be sent
    , InputPollMedia -> Maybe InputThumbnail
thumbnail :: Maybe InputThumbnail.InputThumbnail -- ^ Sticker thumbnail; pass null to skip thumbnail uploading
    , InputPollMedia -> Maybe Int
width     :: Maybe Int                           -- ^ Sticker width
    , InputPollMedia -> Maybe Int
height    :: Maybe Int                           -- ^ Sticker height
    }
  | InputPollMediaVenue -- ^ A venue
    { InputPollMedia -> Maybe Venue
venue :: Maybe Venue.Venue -- ^ Venue to send
    }
  | InputPollMediaVideo -- ^ A video
    { InputPollMedia -> Maybe InputVideo
video :: Maybe InputVideo.InputVideo -- ^ The video to be sent
    }
  deriving (InputPollMedia -> InputPollMedia -> Bool
(InputPollMedia -> InputPollMedia -> Bool)
-> (InputPollMedia -> InputPollMedia -> Bool) -> Eq InputPollMedia
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InputPollMedia -> InputPollMedia -> Bool
== :: InputPollMedia -> InputPollMedia -> Bool
$c/= :: InputPollMedia -> InputPollMedia -> Bool
/= :: InputPollMedia -> InputPollMedia -> Bool
Eq, Int -> InputPollMedia -> ShowS
[InputPollMedia] -> ShowS
InputPollMedia -> String
(Int -> InputPollMedia -> ShowS)
-> (InputPollMedia -> String)
-> ([InputPollMedia] -> ShowS)
-> Show InputPollMedia
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InputPollMedia -> ShowS
showsPrec :: Int -> InputPollMedia -> ShowS
$cshow :: InputPollMedia -> String
show :: InputPollMedia -> String
$cshowList :: [InputPollMedia] -> ShowS
showList :: [InputPollMedia] -> ShowS
Show)

instance I.ShortShow InputPollMedia where
  shortShow :: InputPollMedia -> String
shortShow InputPollMediaAnimation
    { animation :: InputPollMedia -> Maybe InputAnimation
animation = Maybe InputAnimation
animation_
    }
      = String
"InputPollMediaAnimation"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"animation" String -> Maybe InputAnimation -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputAnimation
animation_
        ]
  shortShow InputPollMediaAudio
    { audio :: InputPollMedia -> Maybe InputAudio
audio = Maybe InputAudio
audio_
    }
      = String
"InputPollMediaAudio"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"audio" String -> Maybe InputAudio -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputAudio
audio_
        ]
  shortShow InputPollMediaDocument
    { document :: InputPollMedia -> Maybe InputDocument
document = Maybe InputDocument
document_
    }
      = String
"InputPollMediaDocument"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"document" String -> Maybe InputDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputDocument
document_
        ]
  shortShow InputPollMediaLink
    { url :: InputPollMedia -> Maybe Text
url = Maybe Text
url_
    }
      = String
"InputPollMediaLink"
        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_
        ]
  shortShow InputPollMediaLocation
    { location :: InputPollMedia -> Maybe Location
location = Maybe Location
location_
    }
      = String
"InputPollMediaLocation"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"location" String -> Maybe Location -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Location
location_
        ]
  shortShow InputPollMediaPhoto
    { photo :: InputPollMedia -> Maybe InputPhoto
photo = Maybe InputPhoto
photo_
    }
      = String
"InputPollMediaPhoto"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"photo" String -> Maybe InputPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputPhoto
photo_
        ]
  shortShow InputPollMediaSticker
    { sticker :: InputPollMedia -> Maybe InputFile
sticker   = Maybe InputFile
sticker_
    , thumbnail :: InputPollMedia -> Maybe InputThumbnail
thumbnail = Maybe InputThumbnail
thumbnail_
    , width :: InputPollMedia -> Maybe Int
width     = Maybe Int
width_
    , height :: InputPollMedia -> Maybe Int
height    = Maybe Int
height_
    }
      = String
"InputPollMediaSticker"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"sticker"   String -> Maybe InputFile -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputFile
sticker_
        , String
"thumbnail" String -> Maybe InputThumbnail -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputThumbnail
thumbnail_
        , 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 InputPollMediaVenue
    { venue :: InputPollMedia -> Maybe Venue
venue = Maybe Venue
venue_
    }
      = String
"InputPollMediaVenue"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"venue" String -> Maybe Venue -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Venue
venue_
        ]
  shortShow InputPollMediaVideo
    { video :: InputPollMedia -> Maybe InputVideo
video = Maybe InputVideo
video_
    }
      = String
"InputPollMediaVideo"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"video" String -> Maybe InputVideo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputVideo
video_
        ]

instance AT.FromJSON InputPollMedia where
  parseJSON :: Value -> Parser InputPollMedia
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
"inputPollMediaAnimation" -> Value -> Parser InputPollMedia
parseInputPollMediaAnimation Value
v
      String
"inputPollMediaAudio"     -> Value -> Parser InputPollMedia
parseInputPollMediaAudio Value
v
      String
"inputPollMediaDocument"  -> Value -> Parser InputPollMedia
parseInputPollMediaDocument Value
v
      String
"inputPollMediaLink"      -> Value -> Parser InputPollMedia
parseInputPollMediaLink Value
v
      String
"inputPollMediaLocation"  -> Value -> Parser InputPollMedia
parseInputPollMediaLocation Value
v
      String
"inputPollMediaPhoto"     -> Value -> Parser InputPollMedia
parseInputPollMediaPhoto Value
v
      String
"inputPollMediaSticker"   -> Value -> Parser InputPollMedia
parseInputPollMediaSticker Value
v
      String
"inputPollMediaVenue"     -> Value -> Parser InputPollMedia
parseInputPollMediaVenue Value
v
      String
"inputPollMediaVideo"     -> Value -> Parser InputPollMedia
parseInputPollMediaVideo Value
v
      String
_                         -> Parser InputPollMedia
forall a. Monoid a => a
mempty
    
    where
      parseInputPollMediaAnimation :: A.Value -> AT.Parser InputPollMedia
      parseInputPollMediaAnimation :: Value -> Parser InputPollMedia
parseInputPollMediaAnimation = String
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPollMediaAnimation" ((Object -> Parser InputPollMedia)
 -> Value -> Parser InputPollMedia)
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe InputAnimation
animation_ <- Object
o Object -> Key -> Parser (Maybe InputAnimation)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"animation"
        InputPollMedia -> Parser InputPollMedia
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPollMedia -> Parser InputPollMedia)
-> InputPollMedia -> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ InputPollMediaAnimation
          { animation :: Maybe InputAnimation
animation = Maybe InputAnimation
animation_
          }
      parseInputPollMediaAudio :: A.Value -> AT.Parser InputPollMedia
      parseInputPollMediaAudio :: Value -> Parser InputPollMedia
parseInputPollMediaAudio = String
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPollMediaAudio" ((Object -> Parser InputPollMedia)
 -> Value -> Parser InputPollMedia)
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe InputAudio
audio_ <- Object
o Object -> Key -> Parser (Maybe InputAudio)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"audio"
        InputPollMedia -> Parser InputPollMedia
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPollMedia -> Parser InputPollMedia)
-> InputPollMedia -> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ InputPollMediaAudio
          { audio :: Maybe InputAudio
audio = Maybe InputAudio
audio_
          }
      parseInputPollMediaDocument :: A.Value -> AT.Parser InputPollMedia
      parseInputPollMediaDocument :: Value -> Parser InputPollMedia
parseInputPollMediaDocument = String
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPollMediaDocument" ((Object -> Parser InputPollMedia)
 -> Value -> Parser InputPollMedia)
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe InputDocument
document_ <- Object
o Object -> Key -> Parser (Maybe InputDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"document"
        InputPollMedia -> Parser InputPollMedia
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPollMedia -> Parser InputPollMedia)
-> InputPollMedia -> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ InputPollMediaDocument
          { document :: Maybe InputDocument
document = Maybe InputDocument
document_
          }
      parseInputPollMediaLink :: A.Value -> AT.Parser InputPollMedia
      parseInputPollMediaLink :: Value -> Parser InputPollMedia
parseInputPollMediaLink = String
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPollMediaLink" ((Object -> Parser InputPollMedia)
 -> Value -> Parser InputPollMedia)
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
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"
        InputPollMedia -> Parser InputPollMedia
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPollMedia -> Parser InputPollMedia)
-> InputPollMedia -> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ InputPollMediaLink
          { url :: Maybe Text
url = Maybe Text
url_
          }
      parseInputPollMediaLocation :: A.Value -> AT.Parser InputPollMedia
      parseInputPollMediaLocation :: Value -> Parser InputPollMedia
parseInputPollMediaLocation = String
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPollMediaLocation" ((Object -> Parser InputPollMedia)
 -> Value -> Parser InputPollMedia)
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Location
location_ <- Object
o Object -> Key -> Parser (Maybe Location)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"location"
        InputPollMedia -> Parser InputPollMedia
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPollMedia -> Parser InputPollMedia)
-> InputPollMedia -> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ InputPollMediaLocation
          { location :: Maybe Location
location = Maybe Location
location_
          }
      parseInputPollMediaPhoto :: A.Value -> AT.Parser InputPollMedia
      parseInputPollMediaPhoto :: Value -> Parser InputPollMedia
parseInputPollMediaPhoto = String
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPollMediaPhoto" ((Object -> Parser InputPollMedia)
 -> Value -> Parser InputPollMedia)
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe InputPhoto
photo_ <- Object
o Object -> Key -> Parser (Maybe InputPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        InputPollMedia -> Parser InputPollMedia
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPollMedia -> Parser InputPollMedia)
-> InputPollMedia -> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ InputPollMediaPhoto
          { photo :: Maybe InputPhoto
photo = Maybe InputPhoto
photo_
          }
      parseInputPollMediaSticker :: A.Value -> AT.Parser InputPollMedia
      parseInputPollMediaSticker :: Value -> Parser InputPollMedia
parseInputPollMediaSticker = String
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPollMediaSticker" ((Object -> Parser InputPollMedia)
 -> Value -> Parser InputPollMedia)
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe InputFile
sticker_   <- Object
o Object -> Key -> Parser (Maybe InputFile)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"sticker"
        Maybe InputThumbnail
thumbnail_ <- Object
o Object -> Key -> Parser (Maybe InputThumbnail)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"thumbnail"
        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"
        InputPollMedia -> Parser InputPollMedia
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPollMedia -> Parser InputPollMedia)
-> InputPollMedia -> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ InputPollMediaSticker
          { sticker :: Maybe InputFile
sticker   = Maybe InputFile
sticker_
          , thumbnail :: Maybe InputThumbnail
thumbnail = Maybe InputThumbnail
thumbnail_
          , width :: Maybe Int
width     = Maybe Int
width_
          , height :: Maybe Int
height    = Maybe Int
height_
          }
      parseInputPollMediaVenue :: A.Value -> AT.Parser InputPollMedia
      parseInputPollMediaVenue :: Value -> Parser InputPollMedia
parseInputPollMediaVenue = String
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPollMediaVenue" ((Object -> Parser InputPollMedia)
 -> Value -> Parser InputPollMedia)
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Venue
venue_ <- Object
o Object -> Key -> Parser (Maybe Venue)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"venue"
        InputPollMedia -> Parser InputPollMedia
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPollMedia -> Parser InputPollMedia)
-> InputPollMedia -> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ InputPollMediaVenue
          { venue :: Maybe Venue
venue = Maybe Venue
venue_
          }
      parseInputPollMediaVideo :: A.Value -> AT.Parser InputPollMedia
      parseInputPollMediaVideo :: Value -> Parser InputPollMedia
parseInputPollMediaVideo = String
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPollMediaVideo" ((Object -> Parser InputPollMedia)
 -> Value -> Parser InputPollMedia)
-> (Object -> Parser InputPollMedia)
-> Value
-> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe InputVideo
video_ <- Object
o Object -> Key -> Parser (Maybe InputVideo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"video"
        InputPollMedia -> Parser InputPollMedia
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPollMedia -> Parser InputPollMedia)
-> InputPollMedia -> Parser InputPollMedia
forall a b. (a -> b) -> a -> b
$ InputPollMediaVideo
          { video :: Maybe InputVideo
video = Maybe InputVideo
video_
          }
  parseJSON Value
_ = Parser InputPollMedia
forall a. Monoid a => a
mempty

instance AT.ToJSON InputPollMedia where
  toJSON :: InputPollMedia -> Value
toJSON InputPollMediaAnimation
    { animation :: InputPollMedia -> Maybe InputAnimation
animation = Maybe InputAnimation
animation_
    }
      = [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
"inputPollMediaAnimation"
        , Key
"animation" Key -> Maybe InputAnimation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputAnimation
animation_
        ]
  toJSON InputPollMediaAudio
    { audio :: InputPollMedia -> Maybe InputAudio
audio = Maybe InputAudio
audio_
    }
      = [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
"inputPollMediaAudio"
        , Key
"audio" Key -> Maybe InputAudio -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputAudio
audio_
        ]
  toJSON InputPollMediaDocument
    { document :: InputPollMedia -> Maybe InputDocument
document = Maybe InputDocument
document_
    }
      = [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
"inputPollMediaDocument"
        , Key
"document" Key -> Maybe InputDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputDocument
document_
        ]
  toJSON InputPollMediaLink
    { url :: InputPollMedia -> 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
"inputPollMediaLink"
        , 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 InputPollMediaLocation
    { location :: InputPollMedia -> Maybe Location
location = Maybe Location
location_
    }
      = [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
"inputPollMediaLocation"
        , Key
"location" Key -> Maybe Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Location
location_
        ]
  toJSON InputPollMediaPhoto
    { photo :: InputPollMedia -> Maybe InputPhoto
photo = Maybe InputPhoto
photo_
    }
      = [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
"inputPollMediaPhoto"
        , Key
"photo" Key -> Maybe InputPhoto -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputPhoto
photo_
        ]
  toJSON InputPollMediaSticker
    { sticker :: InputPollMedia -> Maybe InputFile
sticker   = Maybe InputFile
sticker_
    , thumbnail :: InputPollMedia -> Maybe InputThumbnail
thumbnail = Maybe InputThumbnail
thumbnail_
    , width :: InputPollMedia -> Maybe Int
width     = Maybe Int
width_
    , height :: InputPollMedia -> 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
"inputPollMediaSticker"
        , Key
"sticker"   Key -> Maybe InputFile -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputFile
sticker_
        , Key
"thumbnail" Key -> Maybe InputThumbnail -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputThumbnail
thumbnail_
        , 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 InputPollMediaVenue
    { venue :: InputPollMedia -> Maybe Venue
venue = Maybe Venue
venue_
    }
      = [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
"inputPollMediaVenue"
        , Key
"venue" Key -> Maybe Venue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Venue
venue_
        ]
  toJSON InputPollMediaVideo
    { video :: InputPollMedia -> Maybe InputVideo
video = Maybe InputVideo
video_
    }
      = [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
"inputPollMediaVideo"
        , Key
"video" Key -> Maybe InputVideo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputVideo
video_
        ]