module TD.Query.GetInstalledBackgrounds
  (GetInstalledBackgrounds(..)
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I

-- | Returns backgrounds installed by the user. Returns 'TD.Data.Backgrounds.Backgrounds'
data GetInstalledBackgrounds
  = GetInstalledBackgrounds
    { GetInstalledBackgrounds -> Maybe Bool
for_dark_theme :: Maybe Bool -- ^ Pass true to order returned backgrounds for a dark theme
    }
  deriving (GetInstalledBackgrounds -> GetInstalledBackgrounds -> Bool
(GetInstalledBackgrounds -> GetInstalledBackgrounds -> Bool)
-> (GetInstalledBackgrounds -> GetInstalledBackgrounds -> Bool)
-> Eq GetInstalledBackgrounds
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetInstalledBackgrounds -> GetInstalledBackgrounds -> Bool
== :: GetInstalledBackgrounds -> GetInstalledBackgrounds -> Bool
$c/= :: GetInstalledBackgrounds -> GetInstalledBackgrounds -> Bool
/= :: GetInstalledBackgrounds -> GetInstalledBackgrounds -> Bool
Eq, Int -> GetInstalledBackgrounds -> ShowS
[GetInstalledBackgrounds] -> ShowS
GetInstalledBackgrounds -> String
(Int -> GetInstalledBackgrounds -> ShowS)
-> (GetInstalledBackgrounds -> String)
-> ([GetInstalledBackgrounds] -> ShowS)
-> Show GetInstalledBackgrounds
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetInstalledBackgrounds -> ShowS
showsPrec :: Int -> GetInstalledBackgrounds -> ShowS
$cshow :: GetInstalledBackgrounds -> String
show :: GetInstalledBackgrounds -> String
$cshowList :: [GetInstalledBackgrounds] -> ShowS
showList :: [GetInstalledBackgrounds] -> ShowS
Show)

instance I.ShortShow GetInstalledBackgrounds where
  shortShow :: GetInstalledBackgrounds -> String
shortShow
    GetInstalledBackgrounds
      { for_dark_theme :: GetInstalledBackgrounds -> Maybe Bool
for_dark_theme = Maybe Bool
for_dark_theme_
      }
        = String
"GetInstalledBackgrounds"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"for_dark_theme" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
for_dark_theme_
          ]

instance AT.ToJSON GetInstalledBackgrounds where
  toJSON :: GetInstalledBackgrounds -> Value
toJSON
    GetInstalledBackgrounds
      { for_dark_theme :: GetInstalledBackgrounds -> Maybe Bool
for_dark_theme = Maybe Bool
for_dark_theme_
      }
        = [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
"getInstalledBackgrounds"
          , Key
"for_dark_theme" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
for_dark_theme_
          ]