module TD.Query.ReadAllForumTopicPollVotes
  (ReadAllForumTopicPollVotes(..)
  , defaultReadAllForumTopicPollVotes
  ) where

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

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

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

defaultReadAllForumTopicPollVotes :: ReadAllForumTopicPollVotes
defaultReadAllForumTopicPollVotes :: ReadAllForumTopicPollVotes
defaultReadAllForumTopicPollVotes =
  ReadAllForumTopicPollVotes
    { 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
    }