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

instance I.ShortShow GetTonWithdrawalUrl where
  shortShow :: GetTonWithdrawalUrl -> String
shortShow
    GetTonWithdrawalUrl
      { password :: GetTonWithdrawalUrl -> Maybe Text
password = Maybe Text
password_
      }
        = String
"GetTonWithdrawalUrl"
          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 GetTonWithdrawalUrl where
  toJSON :: GetTonWithdrawalUrl -> Value
toJSON
    GetTonWithdrawalUrl
      { password :: GetTonWithdrawalUrl -> 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
"getTonWithdrawalUrl"
          , 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_
          ]