module TD.Query.GetSecretChat
  (GetSecretChat(..)
  ) where

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

-- | Returns information about a secret chat by its identifier. This is an offline request. Returns 'TD.Data.SecretChat.SecretChat'
data GetSecretChat
  = GetSecretChat
    { GetSecretChat -> Maybe Int
secret_chat_id :: Maybe Int -- ^ Secret chat identifier
    }
  deriving (GetSecretChat -> GetSecretChat -> Bool
(GetSecretChat -> GetSecretChat -> Bool)
-> (GetSecretChat -> GetSecretChat -> Bool) -> Eq GetSecretChat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetSecretChat -> GetSecretChat -> Bool
== :: GetSecretChat -> GetSecretChat -> Bool
$c/= :: GetSecretChat -> GetSecretChat -> Bool
/= :: GetSecretChat -> GetSecretChat -> Bool
Eq, Int -> GetSecretChat -> ShowS
[GetSecretChat] -> ShowS
GetSecretChat -> String
(Int -> GetSecretChat -> ShowS)
-> (GetSecretChat -> String)
-> ([GetSecretChat] -> ShowS)
-> Show GetSecretChat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetSecretChat -> ShowS
showsPrec :: Int -> GetSecretChat -> ShowS
$cshow :: GetSecretChat -> String
show :: GetSecretChat -> String
$cshowList :: [GetSecretChat] -> ShowS
showList :: [GetSecretChat] -> ShowS
Show)

instance I.ShortShow GetSecretChat where
  shortShow :: GetSecretChat -> String
shortShow
    GetSecretChat
      { secret_chat_id :: GetSecretChat -> Maybe Int
secret_chat_id = Maybe Int
secret_chat_id_
      }
        = String
"GetSecretChat"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"secret_chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
secret_chat_id_
          ]

instance AT.ToJSON GetSecretChat where
  toJSON :: GetSecretChat -> Value
toJSON
    GetSecretChat
      { secret_chat_id :: GetSecretChat -> Maybe Int
secret_chat_id = Maybe Int
secret_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
"getSecretChat"
          , Key
"secret_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
secret_chat_id_
          ]