module TD.Query.GetOnRampProviderBaseCurrencies
  (GetOnRampProviderBaseCurrencies(..)
  , defaultGetOnRampProviderBaseCurrencies
  ) 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 the list of fiat currencies supported by an on-ramp provider for the given cryptocurrency. Returns 'TD.Data.Currencies.Currencies'
data GetOnRampProviderBaseCurrencies
  = GetOnRampProviderBaseCurrencies
    { GetOnRampProviderBaseCurrencies -> Maybe Text
provider_id    :: Maybe T.Text -- ^ Unique identifier of the on-ramp provider; only for providers that support base currencies
    , GetOnRampProviderBaseCurrencies -> Maybe Text
cryptocurrency :: Maybe T.Text -- ^ The cryptocurrency that will be bought
    }
  deriving (GetOnRampProviderBaseCurrencies
-> GetOnRampProviderBaseCurrencies -> Bool
(GetOnRampProviderBaseCurrencies
 -> GetOnRampProviderBaseCurrencies -> Bool)
-> (GetOnRampProviderBaseCurrencies
    -> GetOnRampProviderBaseCurrencies -> Bool)
-> Eq GetOnRampProviderBaseCurrencies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetOnRampProviderBaseCurrencies
-> GetOnRampProviderBaseCurrencies -> Bool
== :: GetOnRampProviderBaseCurrencies
-> GetOnRampProviderBaseCurrencies -> Bool
$c/= :: GetOnRampProviderBaseCurrencies
-> GetOnRampProviderBaseCurrencies -> Bool
/= :: GetOnRampProviderBaseCurrencies
-> GetOnRampProviderBaseCurrencies -> Bool
Eq, Int -> GetOnRampProviderBaseCurrencies -> ShowS
[GetOnRampProviderBaseCurrencies] -> ShowS
GetOnRampProviderBaseCurrencies -> String
(Int -> GetOnRampProviderBaseCurrencies -> ShowS)
-> (GetOnRampProviderBaseCurrencies -> String)
-> ([GetOnRampProviderBaseCurrencies] -> ShowS)
-> Show GetOnRampProviderBaseCurrencies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetOnRampProviderBaseCurrencies -> ShowS
showsPrec :: Int -> GetOnRampProviderBaseCurrencies -> ShowS
$cshow :: GetOnRampProviderBaseCurrencies -> String
show :: GetOnRampProviderBaseCurrencies -> String
$cshowList :: [GetOnRampProviderBaseCurrencies] -> ShowS
showList :: [GetOnRampProviderBaseCurrencies] -> ShowS
Show)

instance I.ShortShow GetOnRampProviderBaseCurrencies where
  shortShow :: GetOnRampProviderBaseCurrencies -> String
shortShow
    GetOnRampProviderBaseCurrencies
      { provider_id :: GetOnRampProviderBaseCurrencies -> Maybe Text
provider_id    = Maybe Text
provider_id_
      , cryptocurrency :: GetOnRampProviderBaseCurrencies -> Maybe Text
cryptocurrency = Maybe Text
cryptocurrency_
      }
        = String
"GetOnRampProviderBaseCurrencies"
          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_
          ]

instance AT.ToJSON GetOnRampProviderBaseCurrencies where
  toJSON :: GetOnRampProviderBaseCurrencies -> Value
toJSON
    GetOnRampProviderBaseCurrencies
      { provider_id :: GetOnRampProviderBaseCurrencies -> Maybe Text
provider_id    = Maybe Text
provider_id_
      , cryptocurrency :: GetOnRampProviderBaseCurrencies -> Maybe Text
cryptocurrency = Maybe Text
cryptocurrency_
      }
        = [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
"getOnRampProviderBaseCurrencies"
          , 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_
          ]

defaultGetOnRampProviderBaseCurrencies :: GetOnRampProviderBaseCurrencies
defaultGetOnRampProviderBaseCurrencies :: GetOnRampProviderBaseCurrencies
defaultGetOnRampProviderBaseCurrencies =
  GetOnRampProviderBaseCurrencies
    { provider_id :: Maybe Text
provider_id    = Maybe Text
forall a. Maybe a
Nothing
    , cryptocurrency :: Maybe Text
cryptocurrency = Maybe Text
forall a. Maybe a
Nothing
    }