module TD.Query.SetReadDatePrivacySettings
  (SetReadDatePrivacySettings(..)
  ) 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.ReadDatePrivacySettings as ReadDatePrivacySettings

-- | Changes privacy settings for message read date. Returns 'TD.Data.Ok.Ok'
data SetReadDatePrivacySettings
  = SetReadDatePrivacySettings
    { SetReadDatePrivacySettings -> Maybe ReadDatePrivacySettings
settings :: Maybe ReadDatePrivacySettings.ReadDatePrivacySettings -- ^ New settings
    }
  deriving (SetReadDatePrivacySettings -> SetReadDatePrivacySettings -> Bool
(SetReadDatePrivacySettings -> SetReadDatePrivacySettings -> Bool)
-> (SetReadDatePrivacySettings
    -> SetReadDatePrivacySettings -> Bool)
-> Eq SetReadDatePrivacySettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetReadDatePrivacySettings -> SetReadDatePrivacySettings -> Bool
== :: SetReadDatePrivacySettings -> SetReadDatePrivacySettings -> Bool
$c/= :: SetReadDatePrivacySettings -> SetReadDatePrivacySettings -> Bool
/= :: SetReadDatePrivacySettings -> SetReadDatePrivacySettings -> Bool
Eq, Int -> SetReadDatePrivacySettings -> ShowS
[SetReadDatePrivacySettings] -> ShowS
SetReadDatePrivacySettings -> String
(Int -> SetReadDatePrivacySettings -> ShowS)
-> (SetReadDatePrivacySettings -> String)
-> ([SetReadDatePrivacySettings] -> ShowS)
-> Show SetReadDatePrivacySettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetReadDatePrivacySettings -> ShowS
showsPrec :: Int -> SetReadDatePrivacySettings -> ShowS
$cshow :: SetReadDatePrivacySettings -> String
show :: SetReadDatePrivacySettings -> String
$cshowList :: [SetReadDatePrivacySettings] -> ShowS
showList :: [SetReadDatePrivacySettings] -> ShowS
Show)

instance I.ShortShow SetReadDatePrivacySettings where
  shortShow :: SetReadDatePrivacySettings -> String
shortShow
    SetReadDatePrivacySettings
      { settings :: SetReadDatePrivacySettings -> Maybe ReadDatePrivacySettings
settings = Maybe ReadDatePrivacySettings
settings_
      }
        = String
"SetReadDatePrivacySettings"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"settings" String -> Maybe ReadDatePrivacySettings -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ReadDatePrivacySettings
settings_
          ]

instance AT.ToJSON SetReadDatePrivacySettings where
  toJSON :: SetReadDatePrivacySettings -> Value
toJSON
    SetReadDatePrivacySettings
      { settings :: SetReadDatePrivacySettings -> Maybe ReadDatePrivacySettings
settings = Maybe ReadDatePrivacySettings
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
"setReadDatePrivacySettings"
          , Key
"settings" Key -> Maybe ReadDatePrivacySettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ReadDatePrivacySettings
settings_
          ]