module TD.Query.AddPendingLiveStoryReaction
  (AddPendingLiveStoryReaction(..)
  , defaultAddPendingLiveStoryReaction
  ) where

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

-- | Adds pending paid reaction in a live story group call. Can't be used in live stories posted by the current user. Call commitPendingLiveStoryReactions or removePendingLiveStoryReactions to actually send all pending reactions when the undo timer is over or abort the sending. Returns 'TD.Data.Ok.Ok'
data AddPendingLiveStoryReaction
  = AddPendingLiveStoryReaction
    { AddPendingLiveStoryReaction -> Maybe Int
group_call_id :: Maybe Int -- ^ Group call identifier
    , AddPendingLiveStoryReaction -> Maybe Int
star_count    :: Maybe Int -- ^ Number of Telegram Stars to be used for the reaction. The total number of pending paid reactions must not exceed getOption("paid_group_call_message_star_count_max")
    }
  deriving (AddPendingLiveStoryReaction -> AddPendingLiveStoryReaction -> Bool
(AddPendingLiveStoryReaction
 -> AddPendingLiveStoryReaction -> Bool)
-> (AddPendingLiveStoryReaction
    -> AddPendingLiveStoryReaction -> Bool)
-> Eq AddPendingLiveStoryReaction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AddPendingLiveStoryReaction -> AddPendingLiveStoryReaction -> Bool
== :: AddPendingLiveStoryReaction -> AddPendingLiveStoryReaction -> Bool
$c/= :: AddPendingLiveStoryReaction -> AddPendingLiveStoryReaction -> Bool
/= :: AddPendingLiveStoryReaction -> AddPendingLiveStoryReaction -> Bool
Eq, Int -> AddPendingLiveStoryReaction -> ShowS
[AddPendingLiveStoryReaction] -> ShowS
AddPendingLiveStoryReaction -> String
(Int -> AddPendingLiveStoryReaction -> ShowS)
-> (AddPendingLiveStoryReaction -> String)
-> ([AddPendingLiveStoryReaction] -> ShowS)
-> Show AddPendingLiveStoryReaction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AddPendingLiveStoryReaction -> ShowS
showsPrec :: Int -> AddPendingLiveStoryReaction -> ShowS
$cshow :: AddPendingLiveStoryReaction -> String
show :: AddPendingLiveStoryReaction -> String
$cshowList :: [AddPendingLiveStoryReaction] -> ShowS
showList :: [AddPendingLiveStoryReaction] -> ShowS
Show)

instance I.ShortShow AddPendingLiveStoryReaction where
  shortShow :: AddPendingLiveStoryReaction -> String
shortShow
    AddPendingLiveStoryReaction
      { group_call_id :: AddPendingLiveStoryReaction -> Maybe Int
group_call_id = Maybe Int
group_call_id_
      , star_count :: AddPendingLiveStoryReaction -> Maybe Int
star_count    = Maybe Int
star_count_
      }
        = String
"AddPendingLiveStoryReaction"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"group_call_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
group_call_id_
          , String
"star_count"    String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
star_count_
          ]

instance AT.ToJSON AddPendingLiveStoryReaction where
  toJSON :: AddPendingLiveStoryReaction -> Value
toJSON
    AddPendingLiveStoryReaction
      { group_call_id :: AddPendingLiveStoryReaction -> Maybe Int
group_call_id = Maybe Int
group_call_id_
      , star_count :: AddPendingLiveStoryReaction -> Maybe Int
star_count    = Maybe Int
star_count_
      }
        = [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
"addPendingLiveStoryReaction"
          , Key
"group_call_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
group_call_id_
          , Key
"star_count"    Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
star_count_
          ]

defaultAddPendingLiveStoryReaction :: AddPendingLiveStoryReaction
defaultAddPendingLiveStoryReaction :: AddPendingLiveStoryReaction
defaultAddPendingLiveStoryReaction =
  AddPendingLiveStoryReaction
    { group_call_id :: Maybe Int
group_call_id = Maybe Int
forall a. Maybe a
Nothing
    , star_count :: Maybe Int
star_count    = Maybe Int
forall a. Maybe a
Nothing
    }