module TD.Query.ReadAllForumTopicReactions
  (ReadAllForumTopicReactions(..)
  , defaultReadAllForumTopicReactions
  ) 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 topic in a forum supergroup chat or a chat with a bot with topics as read. Returns 'TD.Data.Ok.Ok'
data ReadAllForumTopicReactions
  = ReadAllForumTopicReactions
    { ReadAllForumTopicReactions -> Maybe Int
chat_id        :: Maybe Int -- ^ Chat identifier
    , ReadAllForumTopicReactions -> Maybe Int
forum_topic_id :: Maybe Int -- ^ Forum topic identifier in which reactions are marked as read
    }
  deriving (ReadAllForumTopicReactions -> ReadAllForumTopicReactions -> Bool
(ReadAllForumTopicReactions -> ReadAllForumTopicReactions -> Bool)
-> (ReadAllForumTopicReactions
    -> ReadAllForumTopicReactions -> Bool)
-> Eq ReadAllForumTopicReactions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReadAllForumTopicReactions -> ReadAllForumTopicReactions -> Bool
== :: ReadAllForumTopicReactions -> ReadAllForumTopicReactions -> Bool
$c/= :: ReadAllForumTopicReactions -> ReadAllForumTopicReactions -> Bool
/= :: ReadAllForumTopicReactions -> ReadAllForumTopicReactions -> Bool
Eq, Int -> ReadAllForumTopicReactions -> ShowS
[ReadAllForumTopicReactions] -> ShowS
ReadAllForumTopicReactions -> String
(Int -> ReadAllForumTopicReactions -> ShowS)
-> (ReadAllForumTopicReactions -> String)
-> ([ReadAllForumTopicReactions] -> ShowS)
-> Show ReadAllForumTopicReactions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReadAllForumTopicReactions -> ShowS
showsPrec :: Int -> ReadAllForumTopicReactions -> ShowS
$cshow :: ReadAllForumTopicReactions -> String
show :: ReadAllForumTopicReactions -> String
$cshowList :: [ReadAllForumTopicReactions] -> ShowS
showList :: [ReadAllForumTopicReactions] -> ShowS
Show)

instance I.ShortShow ReadAllForumTopicReactions where
  shortShow :: ReadAllForumTopicReactions -> String
shortShow
    ReadAllForumTopicReactions
      { chat_id :: ReadAllForumTopicReactions -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , forum_topic_id :: ReadAllForumTopicReactions -> Maybe Int
forum_topic_id = Maybe Int
forum_topic_id_
      }
        = String
"ReadAllForumTopicReactions"
          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_
          , String
"forum_topic_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
forum_topic_id_
          ]

instance AT.ToJSON ReadAllForumTopicReactions where
  toJSON :: ReadAllForumTopicReactions -> Value
toJSON
    ReadAllForumTopicReactions
      { chat_id :: ReadAllForumTopicReactions -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , forum_topic_id :: ReadAllForumTopicReactions -> Maybe Int
forum_topic_id = Maybe Int
forum_topic_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
"readAllForumTopicReactions"
          , 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_
          , Key
"forum_topic_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
forum_topic_id_
          ]

defaultReadAllForumTopicReactions :: ReadAllForumTopicReactions
defaultReadAllForumTopicReactions :: ReadAllForumTopicReactions
defaultReadAllForumTopicReactions =
  ReadAllForumTopicReactions
    { chat_id :: Maybe Int
chat_id        = Maybe Int
forall a. Maybe a
Nothing
    , forum_topic_id :: Maybe Int
forum_topic_id = Maybe Int
forall a. Maybe a
Nothing
    }