module TD.Query.RemoveInstalledBackground
  (RemoveInstalledBackground(..)
  ) where

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

-- | Removes background from the list of installed backgrounds. Returns 'TD.Data.Ok.Ok'
data RemoveInstalledBackground
  = RemoveInstalledBackground
    { RemoveInstalledBackground -> Maybe Int
background_id :: Maybe Int -- ^ The background identifier
    }
  deriving (RemoveInstalledBackground -> RemoveInstalledBackground -> Bool
(RemoveInstalledBackground -> RemoveInstalledBackground -> Bool)
-> (RemoveInstalledBackground -> RemoveInstalledBackground -> Bool)
-> Eq RemoveInstalledBackground
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoveInstalledBackground -> RemoveInstalledBackground -> Bool
== :: RemoveInstalledBackground -> RemoveInstalledBackground -> Bool
$c/= :: RemoveInstalledBackground -> RemoveInstalledBackground -> Bool
/= :: RemoveInstalledBackground -> RemoveInstalledBackground -> Bool
Eq, Int -> RemoveInstalledBackground -> ShowS
[RemoveInstalledBackground] -> ShowS
RemoveInstalledBackground -> String
(Int -> RemoveInstalledBackground -> ShowS)
-> (RemoveInstalledBackground -> String)
-> ([RemoveInstalledBackground] -> ShowS)
-> Show RemoveInstalledBackground
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoveInstalledBackground -> ShowS
showsPrec :: Int -> RemoveInstalledBackground -> ShowS
$cshow :: RemoveInstalledBackground -> String
show :: RemoveInstalledBackground -> String
$cshowList :: [RemoveInstalledBackground] -> ShowS
showList :: [RemoveInstalledBackground] -> ShowS
Show)

instance I.ShortShow RemoveInstalledBackground where
  shortShow :: RemoveInstalledBackground -> String
shortShow
    RemoveInstalledBackground
      { background_id :: RemoveInstalledBackground -> Maybe Int
background_id = Maybe Int
background_id_
      }
        = String
"RemoveInstalledBackground"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"background_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
background_id_
          ]

instance AT.ToJSON RemoveInstalledBackground where
  toJSON :: RemoveInstalledBackground -> Value
toJSON
    RemoveInstalledBackground
      { background_id :: RemoveInstalledBackground -> Maybe Int
background_id = Maybe Int
background_id_
      }
        = [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
"removeInstalledBackground"
          , Key
"background_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64  Maybe Int
background_id_
          ]