{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.DeviceFarm.Types.MonetaryAmount where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DeviceFarm.Types.CurrencyCode
import qualified Amazonka.Prelude as Prelude
data MonetaryAmount = MonetaryAmount'
{
MonetaryAmount -> Maybe Double
amount :: Prelude.Maybe Prelude.Double,
MonetaryAmount -> Maybe CurrencyCode
currencyCode :: Prelude.Maybe CurrencyCode
}
deriving (MonetaryAmount -> MonetaryAmount -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonetaryAmount -> MonetaryAmount -> Bool
$c/= :: MonetaryAmount -> MonetaryAmount -> Bool
== :: MonetaryAmount -> MonetaryAmount -> Bool
$c== :: MonetaryAmount -> MonetaryAmount -> Bool
Prelude.Eq, ReadPrec [MonetaryAmount]
ReadPrec MonetaryAmount
Int -> ReadS MonetaryAmount
ReadS [MonetaryAmount]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonetaryAmount]
$creadListPrec :: ReadPrec [MonetaryAmount]
readPrec :: ReadPrec MonetaryAmount
$creadPrec :: ReadPrec MonetaryAmount
readList :: ReadS [MonetaryAmount]
$creadList :: ReadS [MonetaryAmount]
readsPrec :: Int -> ReadS MonetaryAmount
$creadsPrec :: Int -> ReadS MonetaryAmount
Prelude.Read, Int -> MonetaryAmount -> ShowS
[MonetaryAmount] -> ShowS
MonetaryAmount -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonetaryAmount] -> ShowS
$cshowList :: [MonetaryAmount] -> ShowS
show :: MonetaryAmount -> String
$cshow :: MonetaryAmount -> String
showsPrec :: Int -> MonetaryAmount -> ShowS
$cshowsPrec :: Int -> MonetaryAmount -> ShowS
Prelude.Show, forall x. Rep MonetaryAmount x -> MonetaryAmount
forall x. MonetaryAmount -> Rep MonetaryAmount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MonetaryAmount x -> MonetaryAmount
$cfrom :: forall x. MonetaryAmount -> Rep MonetaryAmount x
Prelude.Generic)
newMonetaryAmount ::
MonetaryAmount
newMonetaryAmount :: MonetaryAmount
newMonetaryAmount =
MonetaryAmount'
{ $sel:amount:MonetaryAmount' :: Maybe Double
amount = forall a. Maybe a
Prelude.Nothing,
$sel:currencyCode:MonetaryAmount' :: Maybe CurrencyCode
currencyCode = forall a. Maybe a
Prelude.Nothing
}
monetaryAmount_amount :: Lens.Lens' MonetaryAmount (Prelude.Maybe Prelude.Double)
monetaryAmount_amount :: Lens' MonetaryAmount (Maybe Double)
monetaryAmount_amount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonetaryAmount' {Maybe Double
amount :: Maybe Double
$sel:amount:MonetaryAmount' :: MonetaryAmount -> Maybe Double
amount} -> Maybe Double
amount) (\s :: MonetaryAmount
s@MonetaryAmount' {} Maybe Double
a -> MonetaryAmount
s {$sel:amount:MonetaryAmount' :: Maybe Double
amount = Maybe Double
a} :: MonetaryAmount)
monetaryAmount_currencyCode :: Lens.Lens' MonetaryAmount (Prelude.Maybe CurrencyCode)
monetaryAmount_currencyCode :: Lens' MonetaryAmount (Maybe CurrencyCode)
monetaryAmount_currencyCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonetaryAmount' {Maybe CurrencyCode
currencyCode :: Maybe CurrencyCode
$sel:currencyCode:MonetaryAmount' :: MonetaryAmount -> Maybe CurrencyCode
currencyCode} -> Maybe CurrencyCode
currencyCode) (\s :: MonetaryAmount
s@MonetaryAmount' {} Maybe CurrencyCode
a -> MonetaryAmount
s {$sel:currencyCode:MonetaryAmount' :: Maybe CurrencyCode
currencyCode = Maybe CurrencyCode
a} :: MonetaryAmount)
instance Data.FromJSON MonetaryAmount where
parseJSON :: Value -> Parser MonetaryAmount
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"MonetaryAmount"
( \Object
x ->
Maybe Double -> Maybe CurrencyCode -> MonetaryAmount
MonetaryAmount'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"amount")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"currencyCode")
)
instance Prelude.Hashable MonetaryAmount where
hashWithSalt :: Int -> MonetaryAmount -> Int
hashWithSalt Int
_salt MonetaryAmount' {Maybe Double
Maybe CurrencyCode
currencyCode :: Maybe CurrencyCode
amount :: Maybe Double
$sel:currencyCode:MonetaryAmount' :: MonetaryAmount -> Maybe CurrencyCode
$sel:amount:MonetaryAmount' :: MonetaryAmount -> Maybe Double
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
amount
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CurrencyCode
currencyCode
instance Prelude.NFData MonetaryAmount where
rnf :: MonetaryAmount -> ()
rnf MonetaryAmount' {Maybe Double
Maybe CurrencyCode
currencyCode :: Maybe CurrencyCode
amount :: Maybe Double
$sel:currencyCode:MonetaryAmount' :: MonetaryAmount -> Maybe CurrencyCode
$sel:amount:MonetaryAmount' :: MonetaryAmount -> Maybe Double
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
amount
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CurrencyCode
currencyCode