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

import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Time.Clock.POSIX (POSIXTime)
import GHC.Generics (Generic)

import Telegram.Bot.API.Types.Chat
import Telegram.Bot.API.Types.Common
import Telegram.Bot.API.Types.ReactionType
import Telegram.Bot.API.Types.User
import Telegram.Bot.API.Internal.Utils

-- ** 'MessageReactionUpdated'

-- | This object represents a change of a reaction on a message performed by a user.
data MessageReactionUpdated = MessageReactionUpdated
  { MessageReactionUpdated -> Chat
messageReactionUpdatedChat :: Chat -- ^ The chat containing the message.
  , MessageReactionUpdated -> MessageId
messageReactionUpdatedMessageId :: MessageId -- ^ Unique message identifier inside the chat.
  , MessageReactionUpdated -> Maybe User
messageReactionUpdatedUser :: Maybe User -- ^ The user that changed the reaction, if the user isn't anonymous.
  , MessageReactionUpdated -> Maybe Chat
messageReactionUpdatedActorChat :: Maybe Chat -- ^ The chat on behalf of which the reaction was changed, if the user is anonymous.
  , MessageReactionUpdated -> POSIXTime
messageReactionUpdatedDate :: POSIXTime -- ^ Date of the change in Unix time.
  , MessageReactionUpdated -> [ReactionType]
messageReactionUpdatedOldReaction :: [ReactionType] -- ^ Previous list of reaction types that were set by the user.
  , MessageReactionUpdated -> [ReactionType]
messageReactionUpdatedNewReaction :: [ReactionType] -- ^ New list of reaction types that have been set by the user.
  }
  deriving ((forall x. MessageReactionUpdated -> Rep MessageReactionUpdated x)
-> (forall x.
    Rep MessageReactionUpdated x -> MessageReactionUpdated)
-> Generic MessageReactionUpdated
forall x. Rep MessageReactionUpdated x -> MessageReactionUpdated
forall x. MessageReactionUpdated -> Rep MessageReactionUpdated x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MessageReactionUpdated -> Rep MessageReactionUpdated x
from :: forall x. MessageReactionUpdated -> Rep MessageReactionUpdated x
$cto :: forall x. Rep MessageReactionUpdated x -> MessageReactionUpdated
to :: forall x. Rep MessageReactionUpdated x -> MessageReactionUpdated
Generic, Int -> MessageReactionUpdated -> ShowS
[MessageReactionUpdated] -> ShowS
MessageReactionUpdated -> String
(Int -> MessageReactionUpdated -> ShowS)
-> (MessageReactionUpdated -> String)
-> ([MessageReactionUpdated] -> ShowS)
-> Show MessageReactionUpdated
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MessageReactionUpdated -> ShowS
showsPrec :: Int -> MessageReactionUpdated -> ShowS
$cshow :: MessageReactionUpdated -> String
show :: MessageReactionUpdated -> String
$cshowList :: [MessageReactionUpdated] -> ShowS
showList :: [MessageReactionUpdated] -> ShowS
Show)

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