module TD.Query.GetUserPrivacySettingRules
  (GetUserPrivacySettingRules(..)
  ) 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.UserPrivacySetting as UserPrivacySetting

-- | Returns the current privacy settings. Returns 'TD.Data.UserPrivacySettingRules.UserPrivacySettingRules'
data GetUserPrivacySettingRules
  = GetUserPrivacySettingRules
    { GetUserPrivacySettingRules -> Maybe UserPrivacySetting
setting :: Maybe UserPrivacySetting.UserPrivacySetting -- ^ The privacy setting
    }
  deriving (GetUserPrivacySettingRules -> GetUserPrivacySettingRules -> Bool
(GetUserPrivacySettingRules -> GetUserPrivacySettingRules -> Bool)
-> (GetUserPrivacySettingRules
    -> GetUserPrivacySettingRules -> Bool)
-> Eq GetUserPrivacySettingRules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetUserPrivacySettingRules -> GetUserPrivacySettingRules -> Bool
== :: GetUserPrivacySettingRules -> GetUserPrivacySettingRules -> Bool
$c/= :: GetUserPrivacySettingRules -> GetUserPrivacySettingRules -> Bool
/= :: GetUserPrivacySettingRules -> GetUserPrivacySettingRules -> Bool
Eq, Int -> GetUserPrivacySettingRules -> ShowS
[GetUserPrivacySettingRules] -> ShowS
GetUserPrivacySettingRules -> String
(Int -> GetUserPrivacySettingRules -> ShowS)
-> (GetUserPrivacySettingRules -> String)
-> ([GetUserPrivacySettingRules] -> ShowS)
-> Show GetUserPrivacySettingRules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetUserPrivacySettingRules -> ShowS
showsPrec :: Int -> GetUserPrivacySettingRules -> ShowS
$cshow :: GetUserPrivacySettingRules -> String
show :: GetUserPrivacySettingRules -> String
$cshowList :: [GetUserPrivacySettingRules] -> ShowS
showList :: [GetUserPrivacySettingRules] -> ShowS
Show)

instance I.ShortShow GetUserPrivacySettingRules where
  shortShow :: GetUserPrivacySettingRules -> String
shortShow
    GetUserPrivacySettingRules
      { setting :: GetUserPrivacySettingRules -> Maybe UserPrivacySetting
setting = Maybe UserPrivacySetting
setting_
      }
        = String
"GetUserPrivacySettingRules"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"setting" String -> Maybe UserPrivacySetting -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe UserPrivacySetting
setting_
          ]

instance AT.ToJSON GetUserPrivacySettingRules where
  toJSON :: GetUserPrivacySettingRules -> Value
toJSON
    GetUserPrivacySettingRules
      { setting :: GetUserPrivacySettingRules -> Maybe UserPrivacySetting
setting = Maybe UserPrivacySetting
setting_
      }
        = [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
"getUserPrivacySettingRules"
          , Key
"setting" Key -> Maybe UserPrivacySetting -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe UserPrivacySetting
setting_
          ]