{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.ReactionCount where

import Data.Aeson (FromJSON (..), ToJSON (..))
import GHC.Generics (Generic)

import Telegram.Bot.API.Types.ReactionType
import Telegram.Bot.API.Internal.Utils

-- ** 'ReactionCount'

-- | Represents a reaction added to a message along with the number of times it was added.
data ReactionCount = ReactionCount
      { ReactionCount -> ReactionType
reactionCountType :: ReactionType -- ^ Type of the reaction.
      , ReactionCount -> Int
reactionCountTotalCount :: Int -- ^ Number of times the reaction was added.
      }
  deriving ((forall x. ReactionCount -> Rep ReactionCount x)
-> (forall x. Rep ReactionCount x -> ReactionCount)
-> Generic ReactionCount
forall x. Rep ReactionCount x -> ReactionCount
forall x. ReactionCount -> Rep ReactionCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReactionCount -> Rep ReactionCount x
from :: forall x. ReactionCount -> Rep ReactionCount x
$cto :: forall x. Rep ReactionCount x -> ReactionCount
to :: forall x. Rep ReactionCount x -> ReactionCount
Generic, Int -> ReactionCount -> ShowS
[ReactionCount] -> ShowS
ReactionCount -> String
(Int -> ReactionCount -> ShowS)
-> (ReactionCount -> String)
-> ([ReactionCount] -> ShowS)
-> Show ReactionCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReactionCount -> ShowS
showsPrec :: Int -> ReactionCount -> ShowS
$cshow :: ReactionCount -> String
show :: ReactionCount -> String
$cshowList :: [ReactionCount] -> ShowS
showList :: [ReactionCount] -> ShowS
Show)

instance ToJSON   ReactionCount where toJSON :: ReactionCount -> Value
toJSON = ReactionCount -> Value
forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON ReactionCount where parseJSON :: Value -> Parser ReactionCount
parseJSON = Value -> Parser ReactionCount
forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON