module TD.Query.GetChatSimilarChats
  (GetChatSimilarChats(..)
  ) where

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

-- | Returns a list of chats similar to the given chat. Returns 'TD.Data.Chats.Chats'
data GetChatSimilarChats
  = GetChatSimilarChats
    { GetChatSimilarChats -> Maybe Int
chat_id :: Maybe Int -- ^ Identifier of the target chat; must be an identifier of a channel chat
    }
  deriving (GetChatSimilarChats -> GetChatSimilarChats -> Bool
(GetChatSimilarChats -> GetChatSimilarChats -> Bool)
-> (GetChatSimilarChats -> GetChatSimilarChats -> Bool)
-> Eq GetChatSimilarChats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatSimilarChats -> GetChatSimilarChats -> Bool
== :: GetChatSimilarChats -> GetChatSimilarChats -> Bool
$c/= :: GetChatSimilarChats -> GetChatSimilarChats -> Bool
/= :: GetChatSimilarChats -> GetChatSimilarChats -> Bool
Eq, Int -> GetChatSimilarChats -> ShowS
[GetChatSimilarChats] -> ShowS
GetChatSimilarChats -> String
(Int -> GetChatSimilarChats -> ShowS)
-> (GetChatSimilarChats -> String)
-> ([GetChatSimilarChats] -> ShowS)
-> Show GetChatSimilarChats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatSimilarChats -> ShowS
showsPrec :: Int -> GetChatSimilarChats -> ShowS
$cshow :: GetChatSimilarChats -> String
show :: GetChatSimilarChats -> String
$cshowList :: [GetChatSimilarChats] -> ShowS
showList :: [GetChatSimilarChats] -> ShowS
Show)

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