module TD.Query.GetChatOwnerAfterLeaving
  (GetChatOwnerAfterLeaving(..)
  ) where

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

-- | Returns the user who will become the owner of the chat after 7 days if the current user does not return to the supergroup or channel during that period or immediately for basic groups; requires owner privileges in the chat. Available only for supergroups and channel chats. Returns 'TD.Data.User.User'
data GetChatOwnerAfterLeaving
  = GetChatOwnerAfterLeaving
    { GetChatOwnerAfterLeaving -> Maybe Int
chat_id :: Maybe Int -- ^ Chat identifier
    }
  deriving (GetChatOwnerAfterLeaving -> GetChatOwnerAfterLeaving -> Bool
(GetChatOwnerAfterLeaving -> GetChatOwnerAfterLeaving -> Bool)
-> (GetChatOwnerAfterLeaving -> GetChatOwnerAfterLeaving -> Bool)
-> Eq GetChatOwnerAfterLeaving
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatOwnerAfterLeaving -> GetChatOwnerAfterLeaving -> Bool
== :: GetChatOwnerAfterLeaving -> GetChatOwnerAfterLeaving -> Bool
$c/= :: GetChatOwnerAfterLeaving -> GetChatOwnerAfterLeaving -> Bool
/= :: GetChatOwnerAfterLeaving -> GetChatOwnerAfterLeaving -> Bool
Eq, Int -> GetChatOwnerAfterLeaving -> ShowS
[GetChatOwnerAfterLeaving] -> ShowS
GetChatOwnerAfterLeaving -> String
(Int -> GetChatOwnerAfterLeaving -> ShowS)
-> (GetChatOwnerAfterLeaving -> String)
-> ([GetChatOwnerAfterLeaving] -> ShowS)
-> Show GetChatOwnerAfterLeaving
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatOwnerAfterLeaving -> ShowS
showsPrec :: Int -> GetChatOwnerAfterLeaving -> ShowS
$cshow :: GetChatOwnerAfterLeaving -> String
show :: GetChatOwnerAfterLeaving -> String
$cshowList :: [GetChatOwnerAfterLeaving] -> ShowS
showList :: [GetChatOwnerAfterLeaving] -> ShowS
Show)

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