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

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

import Telegram.Bot.API.Internal.Utils

-- ** 'LabeledPrice'

-- | This object represents a portion of the price for goods or services.
data LabeledPrice = LabelPrice
  { LabeledPrice -> Text
labeledPriceLabel  :: Text  -- ^ Portion label.
  , LabeledPrice -> Int
labeledPriceAmount :: Int -- ^ Price of the product 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. LabeledPrice -> Rep LabeledPrice x)
-> (forall x. Rep LabeledPrice x -> LabeledPrice)
-> Generic LabeledPrice
forall x. Rep LabeledPrice x -> LabeledPrice
forall x. LabeledPrice -> Rep LabeledPrice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. LabeledPrice -> Rep LabeledPrice x
from :: forall x. LabeledPrice -> Rep LabeledPrice x
$cto :: forall x. Rep LabeledPrice x -> LabeledPrice
to :: forall x. Rep LabeledPrice x -> LabeledPrice
Generic, Int -> LabeledPrice -> ShowS
[LabeledPrice] -> ShowS
LabeledPrice -> String
(Int -> LabeledPrice -> ShowS)
-> (LabeledPrice -> String)
-> ([LabeledPrice] -> ShowS)
-> Show LabeledPrice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LabeledPrice -> ShowS
showsPrec :: Int -> LabeledPrice -> ShowS
$cshow :: LabeledPrice -> String
show :: LabeledPrice -> String
$cshowList :: [LabeledPrice] -> ShowS
showList :: [LabeledPrice] -> ShowS
Show)

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