module TD.Query.GetChatsForChatFolderInviteLink
  (GetChatsForChatFolderInviteLink(..)
  ) where

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

-- | Returns identifiers of chats from a chat folder, suitable for adding to a chat folder invite link. Returns 'TD.Data.Chats.Chats'
data GetChatsForChatFolderInviteLink
  = GetChatsForChatFolderInviteLink
    { GetChatsForChatFolderInviteLink -> Maybe Int
chat_folder_id :: Maybe Int -- ^ Chat folder identifier
    }
  deriving (GetChatsForChatFolderInviteLink
-> GetChatsForChatFolderInviteLink -> Bool
(GetChatsForChatFolderInviteLink
 -> GetChatsForChatFolderInviteLink -> Bool)
-> (GetChatsForChatFolderInviteLink
    -> GetChatsForChatFolderInviteLink -> Bool)
-> Eq GetChatsForChatFolderInviteLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatsForChatFolderInviteLink
-> GetChatsForChatFolderInviteLink -> Bool
== :: GetChatsForChatFolderInviteLink
-> GetChatsForChatFolderInviteLink -> Bool
$c/= :: GetChatsForChatFolderInviteLink
-> GetChatsForChatFolderInviteLink -> Bool
/= :: GetChatsForChatFolderInviteLink
-> GetChatsForChatFolderInviteLink -> Bool
Eq, Int -> GetChatsForChatFolderInviteLink -> ShowS
[GetChatsForChatFolderInviteLink] -> ShowS
GetChatsForChatFolderInviteLink -> String
(Int -> GetChatsForChatFolderInviteLink -> ShowS)
-> (GetChatsForChatFolderInviteLink -> String)
-> ([GetChatsForChatFolderInviteLink] -> ShowS)
-> Show GetChatsForChatFolderInviteLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatsForChatFolderInviteLink -> ShowS
showsPrec :: Int -> GetChatsForChatFolderInviteLink -> ShowS
$cshow :: GetChatsForChatFolderInviteLink -> String
show :: GetChatsForChatFolderInviteLink -> String
$cshowList :: [GetChatsForChatFolderInviteLink] -> ShowS
showList :: [GetChatsForChatFolderInviteLink] -> ShowS
Show)

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

instance AT.ToJSON GetChatsForChatFolderInviteLink where
  toJSON :: GetChatsForChatFolderInviteLink -> Value
toJSON
    GetChatsForChatFolderInviteLink
      { chat_folder_id :: GetChatsForChatFolderInviteLink -> Maybe Int
chat_folder_id = Maybe Int
chat_folder_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
"getChatsForChatFolderInviteLink"
          , Key
"chat_folder_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_folder_id_
          ]