{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Route53Domains.Types.PriceWithCurrency
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53Domains.Types.PriceWithCurrency where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Currency-specific price information.
--
-- /See:/ 'newPriceWithCurrency' smart constructor.
data PriceWithCurrency = PriceWithCurrency'
  { -- | The price of a domain, in a specific currency.
    PriceWithCurrency -> Double
price :: Prelude.Double,
    -- | The currency specifier.
    PriceWithCurrency -> Text
currency :: Prelude.Text
  }
  deriving (PriceWithCurrency -> PriceWithCurrency -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PriceWithCurrency -> PriceWithCurrency -> Bool
$c/= :: PriceWithCurrency -> PriceWithCurrency -> Bool
== :: PriceWithCurrency -> PriceWithCurrency -> Bool
$c== :: PriceWithCurrency -> PriceWithCurrency -> Bool
Prelude.Eq, ReadPrec [PriceWithCurrency]
ReadPrec PriceWithCurrency
Int -> ReadS PriceWithCurrency
ReadS [PriceWithCurrency]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PriceWithCurrency]
$creadListPrec :: ReadPrec [PriceWithCurrency]
readPrec :: ReadPrec PriceWithCurrency
$creadPrec :: ReadPrec PriceWithCurrency
readList :: ReadS [PriceWithCurrency]
$creadList :: ReadS [PriceWithCurrency]
readsPrec :: Int -> ReadS PriceWithCurrency
$creadsPrec :: Int -> ReadS PriceWithCurrency
Prelude.Read, Int -> PriceWithCurrency -> ShowS
[PriceWithCurrency] -> ShowS
PriceWithCurrency -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PriceWithCurrency] -> ShowS
$cshowList :: [PriceWithCurrency] -> ShowS
show :: PriceWithCurrency -> String
$cshow :: PriceWithCurrency -> String
showsPrec :: Int -> PriceWithCurrency -> ShowS
$cshowsPrec :: Int -> PriceWithCurrency -> ShowS
Prelude.Show, forall x. Rep PriceWithCurrency x -> PriceWithCurrency
forall x. PriceWithCurrency -> Rep PriceWithCurrency x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PriceWithCurrency x -> PriceWithCurrency
$cfrom :: forall x. PriceWithCurrency -> Rep PriceWithCurrency x
Prelude.Generic)

-- |
-- Create a value of 'PriceWithCurrency' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'price', 'priceWithCurrency_price' - The price of a domain, in a specific currency.
--
-- 'currency', 'priceWithCurrency_currency' - The currency specifier.
newPriceWithCurrency ::
  -- | 'price'
  Prelude.Double ->
  -- | 'currency'
  Prelude.Text ->
  PriceWithCurrency
newPriceWithCurrency :: Double -> Text -> PriceWithCurrency
newPriceWithCurrency Double
pPrice_ Text
pCurrency_ =
  PriceWithCurrency'
    { $sel:price:PriceWithCurrency' :: Double
price = Double
pPrice_,
      $sel:currency:PriceWithCurrency' :: Text
currency = Text
pCurrency_
    }

-- | The price of a domain, in a specific currency.
priceWithCurrency_price :: Lens.Lens' PriceWithCurrency Prelude.Double
priceWithCurrency_price :: Lens' PriceWithCurrency Double
priceWithCurrency_price = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PriceWithCurrency' {Double
price :: Double
$sel:price:PriceWithCurrency' :: PriceWithCurrency -> Double
price} -> Double
price) (\s :: PriceWithCurrency
s@PriceWithCurrency' {} Double
a -> PriceWithCurrency
s {$sel:price:PriceWithCurrency' :: Double
price = Double
a} :: PriceWithCurrency)

-- | The currency specifier.
priceWithCurrency_currency :: Lens.Lens' PriceWithCurrency Prelude.Text
priceWithCurrency_currency :: Lens' PriceWithCurrency Text
priceWithCurrency_currency = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PriceWithCurrency' {Text
currency :: Text
$sel:currency:PriceWithCurrency' :: PriceWithCurrency -> Text
currency} -> Text
currency) (\s :: PriceWithCurrency
s@PriceWithCurrency' {} Text
a -> PriceWithCurrency
s {$sel:currency:PriceWithCurrency' :: Text
currency = Text
a} :: PriceWithCurrency)

instance Data.FromJSON PriceWithCurrency where
  parseJSON :: Value -> Parser PriceWithCurrency
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PriceWithCurrency"
      ( \Object
x ->
          Double -> Text -> PriceWithCurrency
PriceWithCurrency'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Price")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Currency")
      )

instance Prelude.Hashable PriceWithCurrency where
  hashWithSalt :: Int -> PriceWithCurrency -> Int
hashWithSalt Int
_salt PriceWithCurrency' {Double
Text
currency :: Text
price :: Double
$sel:currency:PriceWithCurrency' :: PriceWithCurrency -> Text
$sel:price:PriceWithCurrency' :: PriceWithCurrency -> Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
price
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
currency

instance Prelude.NFData PriceWithCurrency where
  rnf :: PriceWithCurrency -> ()
rnf PriceWithCurrency' {Double
Text
currency :: Text
price :: Double
$sel:currency:PriceWithCurrency' :: PriceWithCurrency -> Text
$sel:price:PriceWithCurrency' :: PriceWithCurrency -> Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Double
price
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
currency