module TD.Query.SetReactionNotificationSettings
  (SetReactionNotificationSettings(..)
  ) where

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

-- | Changes notification settings for reactions. Returns 'TD.Data.Ok.Ok'
data SetReactionNotificationSettings
  = SetReactionNotificationSettings
    { SetReactionNotificationSettings
-> Maybe ReactionNotificationSettings
notification_settings :: Maybe ReactionNotificationSettings.ReactionNotificationSettings -- ^ The new notification settings for reactions
    }
  deriving (SetReactionNotificationSettings
-> SetReactionNotificationSettings -> Bool
(SetReactionNotificationSettings
 -> SetReactionNotificationSettings -> Bool)
-> (SetReactionNotificationSettings
    -> SetReactionNotificationSettings -> Bool)
-> Eq SetReactionNotificationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetReactionNotificationSettings
-> SetReactionNotificationSettings -> Bool
== :: SetReactionNotificationSettings
-> SetReactionNotificationSettings -> Bool
$c/= :: SetReactionNotificationSettings
-> SetReactionNotificationSettings -> Bool
/= :: SetReactionNotificationSettings
-> SetReactionNotificationSettings -> Bool
Eq, Int -> SetReactionNotificationSettings -> ShowS
[SetReactionNotificationSettings] -> ShowS
SetReactionNotificationSettings -> String
(Int -> SetReactionNotificationSettings -> ShowS)
-> (SetReactionNotificationSettings -> String)
-> ([SetReactionNotificationSettings] -> ShowS)
-> Show SetReactionNotificationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetReactionNotificationSettings -> ShowS
showsPrec :: Int -> SetReactionNotificationSettings -> ShowS
$cshow :: SetReactionNotificationSettings -> String
show :: SetReactionNotificationSettings -> String
$cshowList :: [SetReactionNotificationSettings] -> ShowS
showList :: [SetReactionNotificationSettings] -> ShowS
Show)

instance I.ShortShow SetReactionNotificationSettings where
  shortShow :: SetReactionNotificationSettings -> String
shortShow
    SetReactionNotificationSettings
      { notification_settings :: SetReactionNotificationSettings
-> Maybe ReactionNotificationSettings
notification_settings = Maybe ReactionNotificationSettings
notification_settings_
      }
        = String
"SetReactionNotificationSettings"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"notification_settings" String -> Maybe ReactionNotificationSettings -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ReactionNotificationSettings
notification_settings_
          ]

instance AT.ToJSON SetReactionNotificationSettings where
  toJSON :: SetReactionNotificationSettings -> Value
toJSON
    SetReactionNotificationSettings
      { notification_settings :: SetReactionNotificationSettings
-> Maybe ReactionNotificationSettings
notification_settings = Maybe ReactionNotificationSettings
notification_settings_
      }
        = [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
"setReactionNotificationSettings"
          , Key
"notification_settings" Key -> Maybe ReactionNotificationSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ReactionNotificationSettings
notification_settings_
          ]