{-# 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.Consent
-- 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.Consent 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

-- | Customer\'s consent for the owner change request.
--
-- /See:/ 'newConsent' smart constructor.
data Consent = Consent'
  { -- | Maximum amount the customer agreed to accept.
    Consent -> Double
maxPrice :: Prelude.Double,
    -- | Currency for the @MaxPrice@.
    Consent -> Text
currency :: Prelude.Text
  }
  deriving (Consent -> Consent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Consent -> Consent -> Bool
$c/= :: Consent -> Consent -> Bool
== :: Consent -> Consent -> Bool
$c== :: Consent -> Consent -> Bool
Prelude.Eq, ReadPrec [Consent]
ReadPrec Consent
Int -> ReadS Consent
ReadS [Consent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Consent]
$creadListPrec :: ReadPrec [Consent]
readPrec :: ReadPrec Consent
$creadPrec :: ReadPrec Consent
readList :: ReadS [Consent]
$creadList :: ReadS [Consent]
readsPrec :: Int -> ReadS Consent
$creadsPrec :: Int -> ReadS Consent
Prelude.Read, Int -> Consent -> ShowS
[Consent] -> ShowS
Consent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Consent] -> ShowS
$cshowList :: [Consent] -> ShowS
show :: Consent -> String
$cshow :: Consent -> String
showsPrec :: Int -> Consent -> ShowS
$cshowsPrec :: Int -> Consent -> ShowS
Prelude.Show, forall x. Rep Consent x -> Consent
forall x. Consent -> Rep Consent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Consent x -> Consent
$cfrom :: forall x. Consent -> Rep Consent x
Prelude.Generic)

-- |
-- Create a value of 'Consent' 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:
--
-- 'maxPrice', 'consent_maxPrice' - Maximum amount the customer agreed to accept.
--
-- 'currency', 'consent_currency' - Currency for the @MaxPrice@.
newConsent ::
  -- | 'maxPrice'
  Prelude.Double ->
  -- | 'currency'
  Prelude.Text ->
  Consent
newConsent :: Double -> Text -> Consent
newConsent Double
pMaxPrice_ Text
pCurrency_ =
  Consent'
    { $sel:maxPrice:Consent' :: Double
maxPrice = Double
pMaxPrice_,
      $sel:currency:Consent' :: Text
currency = Text
pCurrency_
    }

-- | Maximum amount the customer agreed to accept.
consent_maxPrice :: Lens.Lens' Consent Prelude.Double
consent_maxPrice :: Lens' Consent Double
consent_maxPrice = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Consent' {Double
maxPrice :: Double
$sel:maxPrice:Consent' :: Consent -> Double
maxPrice} -> Double
maxPrice) (\s :: Consent
s@Consent' {} Double
a -> Consent
s {$sel:maxPrice:Consent' :: Double
maxPrice = Double
a} :: Consent)

-- | Currency for the @MaxPrice@.
consent_currency :: Lens.Lens' Consent Prelude.Text
consent_currency :: Lens' Consent Text
consent_currency = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Consent' {Text
currency :: Text
$sel:currency:Consent' :: Consent -> Text
currency} -> Text
currency) (\s :: Consent
s@Consent' {} Text
a -> Consent
s {$sel:currency:Consent' :: Text
currency = Text
a} :: Consent)

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

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

instance Data.ToJSON Consent where
  toJSON :: Consent -> Value
toJSON Consent' {Double
Text
currency :: Text
maxPrice :: Double
$sel:currency:Consent' :: Consent -> Text
$sel:maxPrice:Consent' :: Consent -> Double
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"MaxPrice" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
maxPrice),
            forall a. a -> Maybe a
Prelude.Just (Key
"Currency" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
currency)
          ]
      )