module TD.Query.CommitPendingPaidMessageReactions
  (CommitPendingPaidMessageReactions(..)
  , defaultCommitPendingPaidMessageReactions
  ) where

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

-- | Applies all pending paid reactions on a message. Returns 'TD.Data.Ok.Ok'
data CommitPendingPaidMessageReactions
  = CommitPendingPaidMessageReactions
    { CommitPendingPaidMessageReactions -> Maybe Int
chat_id    :: Maybe Int -- ^ Identifier of the chat to which the message belongs
    , CommitPendingPaidMessageReactions -> Maybe Int
message_id :: Maybe Int -- ^ Identifier of the message
    }
  deriving (CommitPendingPaidMessageReactions
-> CommitPendingPaidMessageReactions -> Bool
(CommitPendingPaidMessageReactions
 -> CommitPendingPaidMessageReactions -> Bool)
-> (CommitPendingPaidMessageReactions
    -> CommitPendingPaidMessageReactions -> Bool)
-> Eq CommitPendingPaidMessageReactions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CommitPendingPaidMessageReactions
-> CommitPendingPaidMessageReactions -> Bool
== :: CommitPendingPaidMessageReactions
-> CommitPendingPaidMessageReactions -> Bool
$c/= :: CommitPendingPaidMessageReactions
-> CommitPendingPaidMessageReactions -> Bool
/= :: CommitPendingPaidMessageReactions
-> CommitPendingPaidMessageReactions -> Bool
Eq, Int -> CommitPendingPaidMessageReactions -> ShowS
[CommitPendingPaidMessageReactions] -> ShowS
CommitPendingPaidMessageReactions -> String
(Int -> CommitPendingPaidMessageReactions -> ShowS)
-> (CommitPendingPaidMessageReactions -> String)
-> ([CommitPendingPaidMessageReactions] -> ShowS)
-> Show CommitPendingPaidMessageReactions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CommitPendingPaidMessageReactions -> ShowS
showsPrec :: Int -> CommitPendingPaidMessageReactions -> ShowS
$cshow :: CommitPendingPaidMessageReactions -> String
show :: CommitPendingPaidMessageReactions -> String
$cshowList :: [CommitPendingPaidMessageReactions] -> ShowS
showList :: [CommitPendingPaidMessageReactions] -> ShowS
Show)

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

instance AT.ToJSON CommitPendingPaidMessageReactions where
  toJSON :: CommitPendingPaidMessageReactions -> Value
toJSON
    CommitPendingPaidMessageReactions
      { chat_id :: CommitPendingPaidMessageReactions -> Maybe Int
chat_id    = Maybe Int
chat_id_
      , message_id :: CommitPendingPaidMessageReactions -> Maybe Int
message_id = Maybe Int
message_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
"commitPendingPaidMessageReactions"
          , 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
"message_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
message_id_
          ]

defaultCommitPendingPaidMessageReactions :: CommitPendingPaidMessageReactions
defaultCommitPendingPaidMessageReactions :: CommitPendingPaidMessageReactions
defaultCommitPendingPaidMessageReactions =
  CommitPendingPaidMessageReactions
    { chat_id :: Maybe Int
chat_id    = Maybe Int
forall a. Maybe a
Nothing
    , message_id :: Maybe Int
message_id = Maybe Int
forall a. Maybe a
Nothing
    }