module TD.Query.GetMessageImportConfirmationText
  (GetMessageImportConfirmationText(..)
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I

-- | Returns a confirmation text to be shown to the user before starting message import. Returns 'TD.Data.Text.Text'
data GetMessageImportConfirmationText
  = GetMessageImportConfirmationText
    { GetMessageImportConfirmationText -> Maybe Int
chat_id :: Maybe Int -- ^ Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info member right
    }
  deriving (GetMessageImportConfirmationText
-> GetMessageImportConfirmationText -> Bool
(GetMessageImportConfirmationText
 -> GetMessageImportConfirmationText -> Bool)
-> (GetMessageImportConfirmationText
    -> GetMessageImportConfirmationText -> Bool)
-> Eq GetMessageImportConfirmationText
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetMessageImportConfirmationText
-> GetMessageImportConfirmationText -> Bool
== :: GetMessageImportConfirmationText
-> GetMessageImportConfirmationText -> Bool
$c/= :: GetMessageImportConfirmationText
-> GetMessageImportConfirmationText -> Bool
/= :: GetMessageImportConfirmationText
-> GetMessageImportConfirmationText -> Bool
Eq, Int -> GetMessageImportConfirmationText -> ShowS
[GetMessageImportConfirmationText] -> ShowS
GetMessageImportConfirmationText -> String
(Int -> GetMessageImportConfirmationText -> ShowS)
-> (GetMessageImportConfirmationText -> String)
-> ([GetMessageImportConfirmationText] -> ShowS)
-> Show GetMessageImportConfirmationText
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetMessageImportConfirmationText -> ShowS
showsPrec :: Int -> GetMessageImportConfirmationText -> ShowS
$cshow :: GetMessageImportConfirmationText -> String
show :: GetMessageImportConfirmationText -> String
$cshowList :: [GetMessageImportConfirmationText] -> ShowS
showList :: [GetMessageImportConfirmationText] -> ShowS
Show)

instance I.ShortShow GetMessageImportConfirmationText where
  shortShow :: GetMessageImportConfirmationText -> String
shortShow
    GetMessageImportConfirmationText
      { chat_id :: GetMessageImportConfirmationText -> Maybe Int
chat_id = Maybe Int
chat_id_
      }
        = String
"GetMessageImportConfirmationText"
          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_
          ]

instance AT.ToJSON GetMessageImportConfirmationText where
  toJSON :: GetMessageImportConfirmationText -> Value
toJSON
    GetMessageImportConfirmationText
      { chat_id :: GetMessageImportConfirmationText -> Maybe Int
chat_id = Maybe Int
chat_id_
      }
        = [Pair] -> Value
A.object
          [ Key
"@type"   Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"getMessageImportConfirmationText"
          , 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_
          ]