module TD.Query.DeleteDefaultBackground
  (DeleteDefaultBackground(..)
  ) where

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

-- | Deletes default background for chats. Returns 'TD.Data.Ok.Ok'
data DeleteDefaultBackground
  = DeleteDefaultBackground
    { DeleteDefaultBackground -> Maybe Bool
for_dark_theme :: Maybe Bool -- ^ Pass true if the background is deleted for a dark theme
    }
  deriving (DeleteDefaultBackground -> DeleteDefaultBackground -> Bool
(DeleteDefaultBackground -> DeleteDefaultBackground -> Bool)
-> (DeleteDefaultBackground -> DeleteDefaultBackground -> Bool)
-> Eq DeleteDefaultBackground
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DeleteDefaultBackground -> DeleteDefaultBackground -> Bool
== :: DeleteDefaultBackground -> DeleteDefaultBackground -> Bool
$c/= :: DeleteDefaultBackground -> DeleteDefaultBackground -> Bool
/= :: DeleteDefaultBackground -> DeleteDefaultBackground -> Bool
Eq, Int -> DeleteDefaultBackground -> ShowS
[DeleteDefaultBackground] -> ShowS
DeleteDefaultBackground -> String
(Int -> DeleteDefaultBackground -> ShowS)
-> (DeleteDefaultBackground -> String)
-> ([DeleteDefaultBackground] -> ShowS)
-> Show DeleteDefaultBackground
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteDefaultBackground -> ShowS
showsPrec :: Int -> DeleteDefaultBackground -> ShowS
$cshow :: DeleteDefaultBackground -> String
show :: DeleteDefaultBackground -> String
$cshowList :: [DeleteDefaultBackground] -> ShowS
showList :: [DeleteDefaultBackground] -> ShowS
Show)

instance I.ShortShow DeleteDefaultBackground where
  shortShow :: DeleteDefaultBackground -> String
shortShow
    DeleteDefaultBackground
      { for_dark_theme :: DeleteDefaultBackground -> Maybe Bool
for_dark_theme = Maybe Bool
for_dark_theme_
      }
        = String
"DeleteDefaultBackground"
          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 DeleteDefaultBackground where
  toJSON :: DeleteDefaultBackground -> Value
toJSON
    DeleteDefaultBackground
      { for_dark_theme :: DeleteDefaultBackground -> 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
"deleteDefaultBackground"
          , 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_
          ]