module TD.Query.SetArchiveChatListSettings
  (SetArchiveChatListSettings(..)
  ) 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.ArchiveChatListSettings as ArchiveChatListSettings

-- | Changes settings for automatic moving of chats to and from the Archive chat lists. Returns 'TD.Data.Ok.Ok'
data SetArchiveChatListSettings
  = SetArchiveChatListSettings
    { SetArchiveChatListSettings -> Maybe ArchiveChatListSettings
settings :: Maybe ArchiveChatListSettings.ArchiveChatListSettings -- ^ New settings
    }
  deriving (SetArchiveChatListSettings -> SetArchiveChatListSettings -> Bool
(SetArchiveChatListSettings -> SetArchiveChatListSettings -> Bool)
-> (SetArchiveChatListSettings
    -> SetArchiveChatListSettings -> Bool)
-> Eq SetArchiveChatListSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetArchiveChatListSettings -> SetArchiveChatListSettings -> Bool
== :: SetArchiveChatListSettings -> SetArchiveChatListSettings -> Bool
$c/= :: SetArchiveChatListSettings -> SetArchiveChatListSettings -> Bool
/= :: SetArchiveChatListSettings -> SetArchiveChatListSettings -> Bool
Eq, Int -> SetArchiveChatListSettings -> ShowS
[SetArchiveChatListSettings] -> ShowS
SetArchiveChatListSettings -> String
(Int -> SetArchiveChatListSettings -> ShowS)
-> (SetArchiveChatListSettings -> String)
-> ([SetArchiveChatListSettings] -> ShowS)
-> Show SetArchiveChatListSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetArchiveChatListSettings -> ShowS
showsPrec :: Int -> SetArchiveChatListSettings -> ShowS
$cshow :: SetArchiveChatListSettings -> String
show :: SetArchiveChatListSettings -> String
$cshowList :: [SetArchiveChatListSettings] -> ShowS
showList :: [SetArchiveChatListSettings] -> ShowS
Show)

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

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