module TD.Query.GetGiftOnChainDelistingTransaction
  (GetGiftOnChainDelistingTransaction(..)
  ) 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 transaction that must be sent from the TON wallet of the current user to cancel the on-chain sale of an upgraded gift for which giftResaleParameters.can_be_managed is true; can be used only if getOption("can_use_ton_wallet"). The sale is canceled only after the transaction is executed on the TON blockchain. Then, the gift will be in the TON wallet of the current user. Returns 'TD.Data.GiftOnChainSaleTransaction.GiftOnChainSaleTransaction'
data GetGiftOnChainDelistingTransaction
  = GetGiftOnChainDelistingTransaction
    { GetGiftOnChainDelistingTransaction -> Maybe Text
gift_name :: Maybe T.Text -- ^ Name of the upgraded gift
    }
  deriving (GetGiftOnChainDelistingTransaction
-> GetGiftOnChainDelistingTransaction -> Bool
(GetGiftOnChainDelistingTransaction
 -> GetGiftOnChainDelistingTransaction -> Bool)
-> (GetGiftOnChainDelistingTransaction
    -> GetGiftOnChainDelistingTransaction -> Bool)
-> Eq GetGiftOnChainDelistingTransaction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetGiftOnChainDelistingTransaction
-> GetGiftOnChainDelistingTransaction -> Bool
== :: GetGiftOnChainDelistingTransaction
-> GetGiftOnChainDelistingTransaction -> Bool
$c/= :: GetGiftOnChainDelistingTransaction
-> GetGiftOnChainDelistingTransaction -> Bool
/= :: GetGiftOnChainDelistingTransaction
-> GetGiftOnChainDelistingTransaction -> Bool
Eq, Int -> GetGiftOnChainDelistingTransaction -> ShowS
[GetGiftOnChainDelistingTransaction] -> ShowS
GetGiftOnChainDelistingTransaction -> String
(Int -> GetGiftOnChainDelistingTransaction -> ShowS)
-> (GetGiftOnChainDelistingTransaction -> String)
-> ([GetGiftOnChainDelistingTransaction] -> ShowS)
-> Show GetGiftOnChainDelistingTransaction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetGiftOnChainDelistingTransaction -> ShowS
showsPrec :: Int -> GetGiftOnChainDelistingTransaction -> ShowS
$cshow :: GetGiftOnChainDelistingTransaction -> String
show :: GetGiftOnChainDelistingTransaction -> String
$cshowList :: [GetGiftOnChainDelistingTransaction] -> ShowS
showList :: [GetGiftOnChainDelistingTransaction] -> ShowS
Show)

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

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