module TD.Query.RemoveRecentlyFoundChat
  (RemoveRecentlyFoundChat(..)
  ) where

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

-- | Removes a chat from the list of recently found chats. Returns 'TD.Data.Ok.Ok'
data RemoveRecentlyFoundChat
  = RemoveRecentlyFoundChat
    { RemoveRecentlyFoundChat -> Maybe Int
chat_id :: Maybe Int -- ^ Identifier of the chat to be removed
    }
  deriving (RemoveRecentlyFoundChat -> RemoveRecentlyFoundChat -> Bool
(RemoveRecentlyFoundChat -> RemoveRecentlyFoundChat -> Bool)
-> (RemoveRecentlyFoundChat -> RemoveRecentlyFoundChat -> Bool)
-> Eq RemoveRecentlyFoundChat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoveRecentlyFoundChat -> RemoveRecentlyFoundChat -> Bool
== :: RemoveRecentlyFoundChat -> RemoveRecentlyFoundChat -> Bool
$c/= :: RemoveRecentlyFoundChat -> RemoveRecentlyFoundChat -> Bool
/= :: RemoveRecentlyFoundChat -> RemoveRecentlyFoundChat -> Bool
Eq, Int -> RemoveRecentlyFoundChat -> ShowS
[RemoveRecentlyFoundChat] -> ShowS
RemoveRecentlyFoundChat -> String
(Int -> RemoveRecentlyFoundChat -> ShowS)
-> (RemoveRecentlyFoundChat -> String)
-> ([RemoveRecentlyFoundChat] -> ShowS)
-> Show RemoveRecentlyFoundChat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoveRecentlyFoundChat -> ShowS
showsPrec :: Int -> RemoveRecentlyFoundChat -> ShowS
$cshow :: RemoveRecentlyFoundChat -> String
show :: RemoveRecentlyFoundChat -> String
$cshowList :: [RemoveRecentlyFoundChat] -> ShowS
showList :: [RemoveRecentlyFoundChat] -> ShowS
Show)

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