{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.Invoice where

import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Text (Text)
import GHC.Generics (Generic)

import Telegram.Bot.API.Internal.Utils

-- ** 'Invoice'

-- | This object contains basic information about an invoice.
data Invoice = Invoice
  { Invoice -> Text
invoiceTitle          :: Text  -- ^ Product name.
  , Invoice -> Text
invoiceDescription    :: Text  -- ^ Product description.
  , Invoice -> Text
invoiceStartParameter :: Text  -- ^ Unique bot deep-linking parameter that can be used to generate this invoice.
  , Invoice -> Text
invoiceCurrency       :: Text  -- ^ Three-letter ISO 4217 currency code.
  , Invoice -> Int
invoiceTotalAmount    :: Int -- ^ Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
  }
  deriving (forall x. Rep Invoice x -> Invoice
forall x. Invoice -> Rep Invoice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Invoice x -> Invoice
$cfrom :: forall x. Invoice -> Rep Invoice x
Generic, Int -> Invoice -> ShowS
[Invoice] -> ShowS
Invoice -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Invoice] -> ShowS
$cshowList :: [Invoice] -> ShowS
show :: Invoice -> String
$cshow :: Invoice -> String
showsPrec :: Int -> Invoice -> ShowS
$cshowsPrec :: Int -> Invoice -> ShowS
Show)

instance ToJSON   Invoice where toJSON :: Invoice -> Value
toJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON Invoice where parseJSON :: Value -> Parser Invoice
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON