module TD.Query.GetUpgradedGiftWithdrawalUrl
  (GetUpgradedGiftWithdrawalUrl(..)
  , defaultGetUpgradedGiftWithdrawalUrl
  ) 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 upgraded gift withdrawal in the TON blockchain as an NFT; requires owner privileges for gifts owned by a chat. Returns 'TD.Data.HttpUrl.HttpUrl'
data GetUpgradedGiftWithdrawalUrl
  = GetUpgradedGiftWithdrawalUrl
    { GetUpgradedGiftWithdrawalUrl -> Maybe Text
received_gift_id :: Maybe T.Text -- ^ Identifier of the gift
    , GetUpgradedGiftWithdrawalUrl -> Maybe Text
password         :: Maybe T.Text -- ^ The 2-step verification password of the current user
    }
  deriving (GetUpgradedGiftWithdrawalUrl
-> GetUpgradedGiftWithdrawalUrl -> Bool
(GetUpgradedGiftWithdrawalUrl
 -> GetUpgradedGiftWithdrawalUrl -> Bool)
-> (GetUpgradedGiftWithdrawalUrl
    -> GetUpgradedGiftWithdrawalUrl -> Bool)
-> Eq GetUpgradedGiftWithdrawalUrl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetUpgradedGiftWithdrawalUrl
-> GetUpgradedGiftWithdrawalUrl -> Bool
== :: GetUpgradedGiftWithdrawalUrl
-> GetUpgradedGiftWithdrawalUrl -> Bool
$c/= :: GetUpgradedGiftWithdrawalUrl
-> GetUpgradedGiftWithdrawalUrl -> Bool
/= :: GetUpgradedGiftWithdrawalUrl
-> GetUpgradedGiftWithdrawalUrl -> Bool
Eq, Int -> GetUpgradedGiftWithdrawalUrl -> ShowS
[GetUpgradedGiftWithdrawalUrl] -> ShowS
GetUpgradedGiftWithdrawalUrl -> String
(Int -> GetUpgradedGiftWithdrawalUrl -> ShowS)
-> (GetUpgradedGiftWithdrawalUrl -> String)
-> ([GetUpgradedGiftWithdrawalUrl] -> ShowS)
-> Show GetUpgradedGiftWithdrawalUrl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetUpgradedGiftWithdrawalUrl -> ShowS
showsPrec :: Int -> GetUpgradedGiftWithdrawalUrl -> ShowS
$cshow :: GetUpgradedGiftWithdrawalUrl -> String
show :: GetUpgradedGiftWithdrawalUrl -> String
$cshowList :: [GetUpgradedGiftWithdrawalUrl] -> ShowS
showList :: [GetUpgradedGiftWithdrawalUrl] -> ShowS
Show)

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

instance AT.ToJSON GetUpgradedGiftWithdrawalUrl where
  toJSON :: GetUpgradedGiftWithdrawalUrl -> Value
toJSON
    GetUpgradedGiftWithdrawalUrl
      { received_gift_id :: GetUpgradedGiftWithdrawalUrl -> Maybe Text
received_gift_id = Maybe Text
received_gift_id_
      , password :: GetUpgradedGiftWithdrawalUrl -> 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
"getUpgradedGiftWithdrawalUrl"
          , Key
"received_gift_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
received_gift_id_
          , 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_
          ]

defaultGetUpgradedGiftWithdrawalUrl :: GetUpgradedGiftWithdrawalUrl
defaultGetUpgradedGiftWithdrawalUrl :: GetUpgradedGiftWithdrawalUrl
defaultGetUpgradedGiftWithdrawalUrl =
  GetUpgradedGiftWithdrawalUrl
    { received_gift_id :: Maybe Text
received_gift_id = Maybe Text
forall a. Maybe a
Nothing
    , password :: Maybe Text
password         = Maybe Text
forall a. Maybe a
Nothing
    }