module TD.Query.WithdrawGrams
  (WithdrawGrams(..)
  ) where

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

-- | Withdraws all available TON Grams of the current user directly to the TON wallet of the current user, which is created automatically if the user has no wallet yet. The user must have a valid temporary password; see createTemporaryPassword. If the wallet is being created, then the request fails with the error "WALLET_CREATING" and must be repeated later. The withdrawal is completed only after the transaction is confirmed on the TON blockchain. Returns 'TD.Data.Ok.Ok'
data WithdrawGrams
  = WithdrawGrams
  deriving (WithdrawGrams -> WithdrawGrams -> Bool
(WithdrawGrams -> WithdrawGrams -> Bool)
-> (WithdrawGrams -> WithdrawGrams -> Bool) -> Eq WithdrawGrams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WithdrawGrams -> WithdrawGrams -> Bool
== :: WithdrawGrams -> WithdrawGrams -> Bool
$c/= :: WithdrawGrams -> WithdrawGrams -> Bool
/= :: WithdrawGrams -> WithdrawGrams -> Bool
Eq, Int -> WithdrawGrams -> ShowS
[WithdrawGrams] -> ShowS
WithdrawGrams -> String
(Int -> WithdrawGrams -> ShowS)
-> (WithdrawGrams -> String)
-> ([WithdrawGrams] -> ShowS)
-> Show WithdrawGrams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WithdrawGrams -> ShowS
showsPrec :: Int -> WithdrawGrams -> ShowS
$cshow :: WithdrawGrams -> String
show :: WithdrawGrams -> String
$cshowList :: [WithdrawGrams] -> ShowS
showList :: [WithdrawGrams] -> ShowS
Show)

instance I.ShortShow WithdrawGrams where
  shortShow :: WithdrawGrams -> String
shortShow
    WithdrawGrams
WithdrawGrams
        = String
"WithdrawGrams"

instance AT.ToJSON WithdrawGrams where
  toJSON :: WithdrawGrams -> Value
toJSON
    WithdrawGrams
WithdrawGrams
        = [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
"withdrawGrams"
          ]