module TD.Query.EditMessageCaption
  (EditMessageCaption(..)
  , defaultEditMessageCaption
  ) 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.ReplyMarkup as ReplyMarkup
import qualified TD.Data.FormattedText as FormattedText

-- | Edits the message content caption. Returns the edited message after the edit is completed on the server side. Returns 'TD.Data.Message.Message'
data EditMessageCaption
  = EditMessageCaption
    { EditMessageCaption -> Maybe Int
chat_id                  :: Maybe Int                         -- ^ The chat the message belongs to
    , EditMessageCaption -> Maybe Int
message_id               :: Maybe Int                         -- ^ Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited
    , EditMessageCaption -> Maybe ReplyMarkup
reply_markup             :: Maybe ReplyMarkup.ReplyMarkup     -- ^ The new message reply markup; pass null if none; for bots only
    , EditMessageCaption -> Maybe FormattedText
caption                  :: Maybe FormattedText.FormattedText -- ^ New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption
    , EditMessageCaption -> Maybe Bool
show_caption_above_media :: Maybe Bool                        -- ^ Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages
    }
  deriving (EditMessageCaption -> EditMessageCaption -> Bool
(EditMessageCaption -> EditMessageCaption -> Bool)
-> (EditMessageCaption -> EditMessageCaption -> Bool)
-> Eq EditMessageCaption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EditMessageCaption -> EditMessageCaption -> Bool
== :: EditMessageCaption -> EditMessageCaption -> Bool
$c/= :: EditMessageCaption -> EditMessageCaption -> Bool
/= :: EditMessageCaption -> EditMessageCaption -> Bool
Eq, Int -> EditMessageCaption -> ShowS
[EditMessageCaption] -> ShowS
EditMessageCaption -> String
(Int -> EditMessageCaption -> ShowS)
-> (EditMessageCaption -> String)
-> ([EditMessageCaption] -> ShowS)
-> Show EditMessageCaption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EditMessageCaption -> ShowS
showsPrec :: Int -> EditMessageCaption -> ShowS
$cshow :: EditMessageCaption -> String
show :: EditMessageCaption -> String
$cshowList :: [EditMessageCaption] -> ShowS
showList :: [EditMessageCaption] -> ShowS
Show)

instance I.ShortShow EditMessageCaption where
  shortShow :: EditMessageCaption -> String
shortShow
    EditMessageCaption
      { chat_id :: EditMessageCaption -> Maybe Int
chat_id                  = Maybe Int
chat_id_
      , message_id :: EditMessageCaption -> Maybe Int
message_id               = Maybe Int
message_id_
      , reply_markup :: EditMessageCaption -> Maybe ReplyMarkup
reply_markup             = Maybe ReplyMarkup
reply_markup_
      , caption :: EditMessageCaption -> Maybe FormattedText
caption                  = Maybe FormattedText
caption_
      , show_caption_above_media :: EditMessageCaption -> Maybe Bool
show_caption_above_media = Maybe Bool
show_caption_above_media_
      }
        = String
"EditMessageCaption"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_id"                  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          , String
"message_id"               String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
          , String
"reply_markup"             String -> Maybe ReplyMarkup -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ReplyMarkup
reply_markup_
          , String
"caption"                  String -> Maybe FormattedText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FormattedText
caption_
          , String
"show_caption_above_media" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
show_caption_above_media_
          ]

instance AT.ToJSON EditMessageCaption where
  toJSON :: EditMessageCaption -> Value
toJSON
    EditMessageCaption
      { chat_id :: EditMessageCaption -> Maybe Int
chat_id                  = Maybe Int
chat_id_
      , message_id :: EditMessageCaption -> Maybe Int
message_id               = Maybe Int
message_id_
      , reply_markup :: EditMessageCaption -> Maybe ReplyMarkup
reply_markup             = Maybe ReplyMarkup
reply_markup_
      , caption :: EditMessageCaption -> Maybe FormattedText
caption                  = Maybe FormattedText
caption_
      , show_caption_above_media :: EditMessageCaption -> Maybe Bool
show_caption_above_media = Maybe Bool
show_caption_above_media_
      }
        = [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
"editMessageCaption"
          , Key
"chat_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
chat_id_
          , Key
"message_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
message_id_
          , Key
"reply_markup"             Key -> Maybe ReplyMarkup -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ReplyMarkup
reply_markup_
          , Key
"caption"                  Key -> Maybe FormattedText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe FormattedText
caption_
          , Key
"show_caption_above_media" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
show_caption_above_media_
          ]

defaultEditMessageCaption :: EditMessageCaption
defaultEditMessageCaption :: EditMessageCaption
defaultEditMessageCaption =
  EditMessageCaption
    { chat_id :: Maybe Int
chat_id                  = Maybe Int
forall a. Maybe a
Nothing
    , message_id :: Maybe Int
message_id               = Maybe Int
forall a. Maybe a
Nothing
    , reply_markup :: Maybe ReplyMarkup
reply_markup             = Maybe ReplyMarkup
forall a. Maybe a
Nothing
    , caption :: Maybe FormattedText
caption                  = Maybe FormattedText
forall a. Maybe a
Nothing
    , show_caption_above_media :: Maybe Bool
show_caption_above_media = Maybe Bool
forall a. Maybe a
Nothing
    }