module TD.Query.GetChatFolderChatsToLeave
  (GetChatFolderChatsToLeave(..)
  ) where

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

-- | Returns identifiers of pinned or always included chats from a chat folder, which are suggested to be left when the chat folder is deleted. Returns 'TD.Data.Chats.Chats'
data GetChatFolderChatsToLeave
  = GetChatFolderChatsToLeave
    { GetChatFolderChatsToLeave -> Maybe Int
chat_folder_id :: Maybe Int -- ^ Chat folder identifier
    }
  deriving (GetChatFolderChatsToLeave -> GetChatFolderChatsToLeave -> Bool
(GetChatFolderChatsToLeave -> GetChatFolderChatsToLeave -> Bool)
-> (GetChatFolderChatsToLeave -> GetChatFolderChatsToLeave -> Bool)
-> Eq GetChatFolderChatsToLeave
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatFolderChatsToLeave -> GetChatFolderChatsToLeave -> Bool
== :: GetChatFolderChatsToLeave -> GetChatFolderChatsToLeave -> Bool
$c/= :: GetChatFolderChatsToLeave -> GetChatFolderChatsToLeave -> Bool
/= :: GetChatFolderChatsToLeave -> GetChatFolderChatsToLeave -> Bool
Eq, Int -> GetChatFolderChatsToLeave -> ShowS
[GetChatFolderChatsToLeave] -> ShowS
GetChatFolderChatsToLeave -> String
(Int -> GetChatFolderChatsToLeave -> ShowS)
-> (GetChatFolderChatsToLeave -> String)
-> ([GetChatFolderChatsToLeave] -> ShowS)
-> Show GetChatFolderChatsToLeave
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatFolderChatsToLeave -> ShowS
showsPrec :: Int -> GetChatFolderChatsToLeave -> ShowS
$cshow :: GetChatFolderChatsToLeave -> String
show :: GetChatFolderChatsToLeave -> String
$cshowList :: [GetChatFolderChatsToLeave] -> ShowS
showList :: [GetChatFolderChatsToLeave] -> ShowS
Show)

instance I.ShortShow GetChatFolderChatsToLeave where
  shortShow :: GetChatFolderChatsToLeave -> String
shortShow
    GetChatFolderChatsToLeave
      { chat_folder_id :: GetChatFolderChatsToLeave -> Maybe Int
chat_folder_id = Maybe Int
chat_folder_id_
      }
        = String
"GetChatFolderChatsToLeave"
          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 GetChatFolderChatsToLeave where
  toJSON :: GetChatFolderChatsToLeave -> Value
toJSON
    GetChatFolderChatsToLeave
      { chat_folder_id :: GetChatFolderChatsToLeave -> 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
"getChatFolderChatsToLeave"
          , 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_
          ]