module TD.Query.GetGramWithdrawalUrl
  (GetGramWithdrawalUrl(..)
  ) where

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

-- | Returns a URL for TON Gram withdrawal from the current user's account. The user must have at least 10 Grams to withdraw and can withdraw up to 100000 Grams in one transaction. Returns 'TD.Data.HttpUrl.HttpUrl'
data GetGramWithdrawalUrl
  = GetGramWithdrawalUrl
    { GetGramWithdrawalUrl -> Maybe Text
password :: Maybe T.Text -- ^ The 2-step verification password of the current user
    }
  deriving (GetGramWithdrawalUrl -> GetGramWithdrawalUrl -> Bool
(GetGramWithdrawalUrl -> GetGramWithdrawalUrl -> Bool)
-> (GetGramWithdrawalUrl -> GetGramWithdrawalUrl -> Bool)
-> Eq GetGramWithdrawalUrl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetGramWithdrawalUrl -> GetGramWithdrawalUrl -> Bool
== :: GetGramWithdrawalUrl -> GetGramWithdrawalUrl -> Bool
$c/= :: GetGramWithdrawalUrl -> GetGramWithdrawalUrl -> Bool
/= :: GetGramWithdrawalUrl -> GetGramWithdrawalUrl -> Bool
Eq, Int -> GetGramWithdrawalUrl -> ShowS
[GetGramWithdrawalUrl] -> ShowS
GetGramWithdrawalUrl -> String
(Int -> GetGramWithdrawalUrl -> ShowS)
-> (GetGramWithdrawalUrl -> String)
-> ([GetGramWithdrawalUrl] -> ShowS)
-> Show GetGramWithdrawalUrl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetGramWithdrawalUrl -> ShowS
showsPrec :: Int -> GetGramWithdrawalUrl -> ShowS
$cshow :: GetGramWithdrawalUrl -> String
show :: GetGramWithdrawalUrl -> String
$cshowList :: [GetGramWithdrawalUrl] -> ShowS
showList :: [GetGramWithdrawalUrl] -> ShowS
Show)

instance I.ShortShow GetGramWithdrawalUrl where
  shortShow :: GetGramWithdrawalUrl -> String
shortShow
    GetGramWithdrawalUrl
      { password :: GetGramWithdrawalUrl -> Maybe Text
password = Maybe Text
password_
      }
        = String
"GetGramWithdrawalUrl"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"password" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
password_
          ]

instance AT.ToJSON GetGramWithdrawalUrl where
  toJSON :: GetGramWithdrawalUrl -> Value
toJSON
    GetGramWithdrawalUrl
      { password :: GetGramWithdrawalUrl -> Maybe Text
password = Maybe Text
password_
      }
        = [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
"getGramWithdrawalUrl"
          , Key
"password" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
password_
          ]