module TD.Query.ReadAllChatMentions
  (ReadAllChatMentions(..)
  ) where

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

-- | Marks all mentions in a chat as read. Returns 'TD.Data.Ok.Ok'
data ReadAllChatMentions
  = ReadAllChatMentions
    { ReadAllChatMentions -> Maybe Int
chat_id :: Maybe Int -- ^ Chat identifier
    }
  deriving (ReadAllChatMentions -> ReadAllChatMentions -> Bool
(ReadAllChatMentions -> ReadAllChatMentions -> Bool)
-> (ReadAllChatMentions -> ReadAllChatMentions -> Bool)
-> Eq ReadAllChatMentions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReadAllChatMentions -> ReadAllChatMentions -> Bool
== :: ReadAllChatMentions -> ReadAllChatMentions -> Bool
$c/= :: ReadAllChatMentions -> ReadAllChatMentions -> Bool
/= :: ReadAllChatMentions -> ReadAllChatMentions -> Bool
Eq, Int -> ReadAllChatMentions -> ShowS
[ReadAllChatMentions] -> ShowS
ReadAllChatMentions -> String
(Int -> ReadAllChatMentions -> ShowS)
-> (ReadAllChatMentions -> String)
-> ([ReadAllChatMentions] -> ShowS)
-> Show ReadAllChatMentions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReadAllChatMentions -> ShowS
showsPrec :: Int -> ReadAllChatMentions -> ShowS
$cshow :: ReadAllChatMentions -> String
show :: ReadAllChatMentions -> String
$cshowList :: [ReadAllChatMentions] -> ShowS
showList :: [ReadAllChatMentions] -> ShowS
Show)

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