module TD.Query.SetAutosaveSettings
(SetAutosaveSettings(..)
, defaultSetAutosaveSettings
) 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.AutosaveSettingsScope as AutosaveSettingsScope
import qualified TD.Data.ScopeAutosaveSettings as ScopeAutosaveSettings
data SetAutosaveSettings
= SetAutosaveSettings
{ SetAutosaveSettings -> Maybe AutosaveSettingsScope
scope :: Maybe AutosaveSettingsScope.AutosaveSettingsScope
, SetAutosaveSettings -> Maybe ScopeAutosaveSettings
settings :: Maybe ScopeAutosaveSettings.ScopeAutosaveSettings
}
deriving (SetAutosaveSettings -> SetAutosaveSettings -> Bool
(SetAutosaveSettings -> SetAutosaveSettings -> Bool)
-> (SetAutosaveSettings -> SetAutosaveSettings -> Bool)
-> Eq SetAutosaveSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetAutosaveSettings -> SetAutosaveSettings -> Bool
== :: SetAutosaveSettings -> SetAutosaveSettings -> Bool
$c/= :: SetAutosaveSettings -> SetAutosaveSettings -> Bool
/= :: SetAutosaveSettings -> SetAutosaveSettings -> Bool
Eq, Int -> SetAutosaveSettings -> ShowS
[SetAutosaveSettings] -> ShowS
SetAutosaveSettings -> String
(Int -> SetAutosaveSettings -> ShowS)
-> (SetAutosaveSettings -> String)
-> ([SetAutosaveSettings] -> ShowS)
-> Show SetAutosaveSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetAutosaveSettings -> ShowS
showsPrec :: Int -> SetAutosaveSettings -> ShowS
$cshow :: SetAutosaveSettings -> String
show :: SetAutosaveSettings -> String
$cshowList :: [SetAutosaveSettings] -> ShowS
showList :: [SetAutosaveSettings] -> ShowS
Show)
instance I.ShortShow SetAutosaveSettings where
shortShow :: SetAutosaveSettings -> String
shortShow
SetAutosaveSettings
{ scope :: SetAutosaveSettings -> Maybe AutosaveSettingsScope
scope = Maybe AutosaveSettingsScope
scope_
, settings :: SetAutosaveSettings -> Maybe ScopeAutosaveSettings
settings = Maybe ScopeAutosaveSettings
settings_
}
= String
"SetAutosaveSettings"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"scope" String -> Maybe AutosaveSettingsScope -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe AutosaveSettingsScope
scope_
, String
"settings" String -> Maybe ScopeAutosaveSettings -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ScopeAutosaveSettings
settings_
]
instance AT.ToJSON SetAutosaveSettings where
toJSON :: SetAutosaveSettings -> Value
toJSON
SetAutosaveSettings
{ scope :: SetAutosaveSettings -> Maybe AutosaveSettingsScope
scope = Maybe AutosaveSettingsScope
scope_
, settings :: SetAutosaveSettings -> Maybe ScopeAutosaveSettings
settings = Maybe ScopeAutosaveSettings
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
"setAutosaveSettings"
, Key
"scope" Key -> Maybe AutosaveSettingsScope -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe AutosaveSettingsScope
scope_
, Key
"settings" Key -> Maybe ScopeAutosaveSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ScopeAutosaveSettings
settings_
]
defaultSetAutosaveSettings :: SetAutosaveSettings
defaultSetAutosaveSettings :: SetAutosaveSettings
defaultSetAutosaveSettings =
SetAutosaveSettings
{ scope :: Maybe AutosaveSettingsScope
scope = Maybe AutosaveSettingsScope
forall a. Maybe a
Nothing
, settings :: Maybe ScopeAutosaveSettings
settings = Maybe ScopeAutosaveSettings
forall a. Maybe a
Nothing
}