module TD.Query.RemoveProxy
  (RemoveProxy(..)
  ) where

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

-- | Removes a proxy server. Can be called before authorization. Returns 'TD.Data.Ok.Ok'
data RemoveProxy
  = RemoveProxy
    { RemoveProxy -> Maybe Int
proxy_id :: Maybe Int -- ^ Proxy identifier
    }
  deriving (RemoveProxy -> RemoveProxy -> Bool
(RemoveProxy -> RemoveProxy -> Bool)
-> (RemoveProxy -> RemoveProxy -> Bool) -> Eq RemoveProxy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoveProxy -> RemoveProxy -> Bool
== :: RemoveProxy -> RemoveProxy -> Bool
$c/= :: RemoveProxy -> RemoveProxy -> Bool
/= :: RemoveProxy -> RemoveProxy -> Bool
Eq, Int -> RemoveProxy -> ShowS
[RemoveProxy] -> ShowS
RemoveProxy -> String
(Int -> RemoveProxy -> ShowS)
-> (RemoveProxy -> String)
-> ([RemoveProxy] -> ShowS)
-> Show RemoveProxy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoveProxy -> ShowS
showsPrec :: Int -> RemoveProxy -> ShowS
$cshow :: RemoveProxy -> String
show :: RemoveProxy -> String
$cshowList :: [RemoveProxy] -> ShowS
showList :: [RemoveProxy] -> ShowS
Show)

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

instance AT.ToJSON RemoveProxy where
  toJSON :: RemoveProxy -> Value
toJSON
    RemoveProxy
      { proxy_id :: RemoveProxy -> Maybe Int
proxy_id = Maybe Int
proxy_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
"removeProxy"
          , Key
"proxy_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
proxy_id_
          ]