module TD.Query.GetAddressTonWallet
  (GetAddressTonWallet(..)
  ) 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 information about a TON wallet with the given address; can be used only if getOption("can_use_ton_wallet"). Returns 'TD.Data.UserTonWalletAddress.UserTonWalletAddress'
data GetAddressTonWallet
  = GetAddressTonWallet
    { GetAddressTonWallet -> Maybe Text
address :: Maybe T.Text -- ^ Address in the TON blockchain
    }
  deriving (GetAddressTonWallet -> GetAddressTonWallet -> Bool
(GetAddressTonWallet -> GetAddressTonWallet -> Bool)
-> (GetAddressTonWallet -> GetAddressTonWallet -> Bool)
-> Eq GetAddressTonWallet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetAddressTonWallet -> GetAddressTonWallet -> Bool
== :: GetAddressTonWallet -> GetAddressTonWallet -> Bool
$c/= :: GetAddressTonWallet -> GetAddressTonWallet -> Bool
/= :: GetAddressTonWallet -> GetAddressTonWallet -> Bool
Eq, Int -> GetAddressTonWallet -> ShowS
[GetAddressTonWallet] -> ShowS
GetAddressTonWallet -> String
(Int -> GetAddressTonWallet -> ShowS)
-> (GetAddressTonWallet -> String)
-> ([GetAddressTonWallet] -> ShowS)
-> Show GetAddressTonWallet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetAddressTonWallet -> ShowS
showsPrec :: Int -> GetAddressTonWallet -> ShowS
$cshow :: GetAddressTonWallet -> String
show :: GetAddressTonWallet -> String
$cshowList :: [GetAddressTonWallet] -> ShowS
showList :: [GetAddressTonWallet] -> ShowS
Show)

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

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