module TD.Query.GetOnRampPaymentQuote
  (GetOnRampPaymentQuote(..)
  , defaultGetOnRampPaymentQuote
  ) 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 quote for an on-ramp payment; only for providers that support quote retrieval. Returns 'TD.Data.OnRampPaymentQuote.OnRampPaymentQuote'
data GetOnRampPaymentQuote
  = GetOnRampPaymentQuote
    { GetOnRampPaymentQuote -> Maybe Text
provider_id           :: Maybe T.Text -- ^ Unique identifier of the on-ramp provider
    , GetOnRampPaymentQuote -> Maybe Text
cryptocurrency        :: Maybe T.Text -- ^ The cryptocurrency that will be bought
    , GetOnRampPaymentQuote -> Maybe Text
base_currency         :: Maybe T.Text -- ^ ISO 4217 currency code of the currency that will be used for the purchase
    , GetOnRampPaymentQuote -> Maybe Text
cryptocurrency_amount :: Maybe T.Text -- ^ The amount of the cryptocurrency to buy; pass an empty string if the user selected base_currency_amount
    , GetOnRampPaymentQuote -> Maybe Text
base_currency_amount  :: Maybe T.Text -- ^ The amount of the base currency to spend; pass an empty string if the user selected cryptocurrency_amount
    , GetOnRampPaymentQuote -> Maybe Text
payment_method_name   :: Maybe T.Text -- ^ Name of the chosen payment method; pass an empty string if none
    }
  deriving (GetOnRampPaymentQuote -> GetOnRampPaymentQuote -> Bool
(GetOnRampPaymentQuote -> GetOnRampPaymentQuote -> Bool)
-> (GetOnRampPaymentQuote -> GetOnRampPaymentQuote -> Bool)
-> Eq GetOnRampPaymentQuote
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetOnRampPaymentQuote -> GetOnRampPaymentQuote -> Bool
== :: GetOnRampPaymentQuote -> GetOnRampPaymentQuote -> Bool
$c/= :: GetOnRampPaymentQuote -> GetOnRampPaymentQuote -> Bool
/= :: GetOnRampPaymentQuote -> GetOnRampPaymentQuote -> Bool
Eq, Int -> GetOnRampPaymentQuote -> ShowS
[GetOnRampPaymentQuote] -> ShowS
GetOnRampPaymentQuote -> String
(Int -> GetOnRampPaymentQuote -> ShowS)
-> (GetOnRampPaymentQuote -> String)
-> ([GetOnRampPaymentQuote] -> ShowS)
-> Show GetOnRampPaymentQuote
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetOnRampPaymentQuote -> ShowS
showsPrec :: Int -> GetOnRampPaymentQuote -> ShowS
$cshow :: GetOnRampPaymentQuote -> String
show :: GetOnRampPaymentQuote -> String
$cshowList :: [GetOnRampPaymentQuote] -> ShowS
showList :: [GetOnRampPaymentQuote] -> ShowS
Show)

instance I.ShortShow GetOnRampPaymentQuote where
  shortShow :: GetOnRampPaymentQuote -> String
shortShow
    GetOnRampPaymentQuote
      { provider_id :: GetOnRampPaymentQuote -> Maybe Text
provider_id           = Maybe Text
provider_id_
      , cryptocurrency :: GetOnRampPaymentQuote -> Maybe Text
cryptocurrency        = Maybe Text
cryptocurrency_
      , base_currency :: GetOnRampPaymentQuote -> Maybe Text
base_currency         = Maybe Text
base_currency_
      , cryptocurrency_amount :: GetOnRampPaymentQuote -> Maybe Text
cryptocurrency_amount = Maybe Text
cryptocurrency_amount_
      , base_currency_amount :: GetOnRampPaymentQuote -> Maybe Text
base_currency_amount  = Maybe Text
base_currency_amount_
      , payment_method_name :: GetOnRampPaymentQuote -> Maybe Text
payment_method_name   = Maybe Text
payment_method_name_
      }
        = String
"GetOnRampPaymentQuote"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"provider_id"           String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
provider_id_
          , String
"cryptocurrency"        String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
cryptocurrency_
          , String
"base_currency"         String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
base_currency_
          , String
"cryptocurrency_amount" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
cryptocurrency_amount_
          , String
"base_currency_amount"  String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
base_currency_amount_
          , String
"payment_method_name"   String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
payment_method_name_
          ]

instance AT.ToJSON GetOnRampPaymentQuote where
  toJSON :: GetOnRampPaymentQuote -> Value
toJSON
    GetOnRampPaymentQuote
      { provider_id :: GetOnRampPaymentQuote -> Maybe Text
provider_id           = Maybe Text
provider_id_
      , cryptocurrency :: GetOnRampPaymentQuote -> Maybe Text
cryptocurrency        = Maybe Text
cryptocurrency_
      , base_currency :: GetOnRampPaymentQuote -> Maybe Text
base_currency         = Maybe Text
base_currency_
      , cryptocurrency_amount :: GetOnRampPaymentQuote -> Maybe Text
cryptocurrency_amount = Maybe Text
cryptocurrency_amount_
      , base_currency_amount :: GetOnRampPaymentQuote -> Maybe Text
base_currency_amount  = Maybe Text
base_currency_amount_
      , payment_method_name :: GetOnRampPaymentQuote -> Maybe Text
payment_method_name   = Maybe Text
payment_method_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
"getOnRampPaymentQuote"
          , Key
"provider_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
provider_id_
          , Key
"cryptocurrency"        Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
cryptocurrency_
          , Key
"base_currency"         Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
base_currency_
          , Key
"cryptocurrency_amount" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
cryptocurrency_amount_
          , Key
"base_currency_amount"  Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
base_currency_amount_
          , Key
"payment_method_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
payment_method_name_
          ]

defaultGetOnRampPaymentQuote :: GetOnRampPaymentQuote
defaultGetOnRampPaymentQuote :: GetOnRampPaymentQuote
defaultGetOnRampPaymentQuote =
  GetOnRampPaymentQuote
    { provider_id :: Maybe Text
provider_id           = Maybe Text
forall a. Maybe a
Nothing
    , cryptocurrency :: Maybe Text
cryptocurrency        = Maybe Text
forall a. Maybe a
Nothing
    , base_currency :: Maybe Text
base_currency         = Maybe Text
forall a. Maybe a
Nothing
    , cryptocurrency_amount :: Maybe Text
cryptocurrency_amount = Maybe Text
forall a. Maybe a
Nothing
    , base_currency_amount :: Maybe Text
base_currency_amount  = Maybe Text
forall a. Maybe a
Nothing
    , payment_method_name :: Maybe Text
payment_method_name   = Maybe Text
forall a. Maybe a
Nothing
    }