module TD.Query.ReadAllChatReactions
  (ReadAllChatReactions(..)
  ) where

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

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

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