module TD.Query.GetScopeNotificationSettings
  (GetScopeNotificationSettings(..)
  ) 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.NotificationSettingsScope as NotificationSettingsScope

-- | Returns the notification settings for chats of a given type. Returns 'TD.Data.ScopeNotificationSettings.ScopeNotificationSettings'
data GetScopeNotificationSettings
  = GetScopeNotificationSettings
    { GetScopeNotificationSettings -> Maybe NotificationSettingsScope
scope :: Maybe NotificationSettingsScope.NotificationSettingsScope -- ^ Types of chats for which to return the notification settings information
    }
  deriving (GetScopeNotificationSettings
-> GetScopeNotificationSettings -> Bool
(GetScopeNotificationSettings
 -> GetScopeNotificationSettings -> Bool)
-> (GetScopeNotificationSettings
    -> GetScopeNotificationSettings -> Bool)
-> Eq GetScopeNotificationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetScopeNotificationSettings
-> GetScopeNotificationSettings -> Bool
== :: GetScopeNotificationSettings
-> GetScopeNotificationSettings -> Bool
$c/= :: GetScopeNotificationSettings
-> GetScopeNotificationSettings -> Bool
/= :: GetScopeNotificationSettings
-> GetScopeNotificationSettings -> Bool
Eq, Int -> GetScopeNotificationSettings -> ShowS
[GetScopeNotificationSettings] -> ShowS
GetScopeNotificationSettings -> String
(Int -> GetScopeNotificationSettings -> ShowS)
-> (GetScopeNotificationSettings -> String)
-> ([GetScopeNotificationSettings] -> ShowS)
-> Show GetScopeNotificationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetScopeNotificationSettings -> ShowS
showsPrec :: Int -> GetScopeNotificationSettings -> ShowS
$cshow :: GetScopeNotificationSettings -> String
show :: GetScopeNotificationSettings -> String
$cshowList :: [GetScopeNotificationSettings] -> ShowS
showList :: [GetScopeNotificationSettings] -> ShowS
Show)

instance I.ShortShow GetScopeNotificationSettings where
  shortShow :: GetScopeNotificationSettings -> String
shortShow
    GetScopeNotificationSettings
      { scope :: GetScopeNotificationSettings -> Maybe NotificationSettingsScope
scope = Maybe NotificationSettingsScope
scope_
      }
        = String
"GetScopeNotificationSettings"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"scope" String -> Maybe NotificationSettingsScope -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe NotificationSettingsScope
scope_
          ]

instance AT.ToJSON GetScopeNotificationSettings where
  toJSON :: GetScopeNotificationSettings -> Value
toJSON
    GetScopeNotificationSettings
      { scope :: GetScopeNotificationSettings -> Maybe NotificationSettingsScope
scope = Maybe NotificationSettingsScope
scope_
      }
        = [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
"getScopeNotificationSettings"
          , Key
"scope" Key -> Maybe NotificationSettingsScope -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe NotificationSettingsScope
scope_
          ]