{-# 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.BillingConductor.Types.UpdateCustomLineItemPercentageChargeDetails
-- 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.BillingConductor.Types.UpdateCustomLineItemPercentageChargeDetails 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

-- | A representation of the new charge details that are associated with a
-- percentage custom line item.
--
-- /See:/ 'newUpdateCustomLineItemPercentageChargeDetails' smart constructor.
data UpdateCustomLineItemPercentageChargeDetails = UpdateCustomLineItemPercentageChargeDetails'
  { -- | The custom line item\'s new percentage value. This will be multiplied
    -- against the combined value of its associated resources to determine its
    -- charge value.
    UpdateCustomLineItemPercentageChargeDetails -> Double
percentageValue :: Prelude.Double
  }
  deriving (UpdateCustomLineItemPercentageChargeDetails
-> UpdateCustomLineItemPercentageChargeDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCustomLineItemPercentageChargeDetails
-> UpdateCustomLineItemPercentageChargeDetails -> Bool
$c/= :: UpdateCustomLineItemPercentageChargeDetails
-> UpdateCustomLineItemPercentageChargeDetails -> Bool
== :: UpdateCustomLineItemPercentageChargeDetails
-> UpdateCustomLineItemPercentageChargeDetails -> Bool
$c== :: UpdateCustomLineItemPercentageChargeDetails
-> UpdateCustomLineItemPercentageChargeDetails -> Bool
Prelude.Eq, ReadPrec [UpdateCustomLineItemPercentageChargeDetails]
ReadPrec UpdateCustomLineItemPercentageChargeDetails
Int -> ReadS UpdateCustomLineItemPercentageChargeDetails
ReadS [UpdateCustomLineItemPercentageChargeDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCustomLineItemPercentageChargeDetails]
$creadListPrec :: ReadPrec [UpdateCustomLineItemPercentageChargeDetails]
readPrec :: ReadPrec UpdateCustomLineItemPercentageChargeDetails
$creadPrec :: ReadPrec UpdateCustomLineItemPercentageChargeDetails
readList :: ReadS [UpdateCustomLineItemPercentageChargeDetails]
$creadList :: ReadS [UpdateCustomLineItemPercentageChargeDetails]
readsPrec :: Int -> ReadS UpdateCustomLineItemPercentageChargeDetails
$creadsPrec :: Int -> ReadS UpdateCustomLineItemPercentageChargeDetails
Prelude.Read, Int -> UpdateCustomLineItemPercentageChargeDetails -> ShowS
[UpdateCustomLineItemPercentageChargeDetails] -> ShowS
UpdateCustomLineItemPercentageChargeDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCustomLineItemPercentageChargeDetails] -> ShowS
$cshowList :: [UpdateCustomLineItemPercentageChargeDetails] -> ShowS
show :: UpdateCustomLineItemPercentageChargeDetails -> String
$cshow :: UpdateCustomLineItemPercentageChargeDetails -> String
showsPrec :: Int -> UpdateCustomLineItemPercentageChargeDetails -> ShowS
$cshowsPrec :: Int -> UpdateCustomLineItemPercentageChargeDetails -> ShowS
Prelude.Show, forall x.
Rep UpdateCustomLineItemPercentageChargeDetails x
-> UpdateCustomLineItemPercentageChargeDetails
forall x.
UpdateCustomLineItemPercentageChargeDetails
-> Rep UpdateCustomLineItemPercentageChargeDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateCustomLineItemPercentageChargeDetails x
-> UpdateCustomLineItemPercentageChargeDetails
$cfrom :: forall x.
UpdateCustomLineItemPercentageChargeDetails
-> Rep UpdateCustomLineItemPercentageChargeDetails x
Prelude.Generic)

-- |
-- Create a value of 'UpdateCustomLineItemPercentageChargeDetails' 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:
--
-- 'percentageValue', 'updateCustomLineItemPercentageChargeDetails_percentageValue' - The custom line item\'s new percentage value. This will be multiplied
-- against the combined value of its associated resources to determine its
-- charge value.
newUpdateCustomLineItemPercentageChargeDetails ::
  -- | 'percentageValue'
  Prelude.Double ->
  UpdateCustomLineItemPercentageChargeDetails
newUpdateCustomLineItemPercentageChargeDetails :: Double -> UpdateCustomLineItemPercentageChargeDetails
newUpdateCustomLineItemPercentageChargeDetails
  Double
pPercentageValue_ =
    UpdateCustomLineItemPercentageChargeDetails'
      { $sel:percentageValue:UpdateCustomLineItemPercentageChargeDetails' :: Double
percentageValue =
          Double
pPercentageValue_
      }

-- | The custom line item\'s new percentage value. This will be multiplied
-- against the combined value of its associated resources to determine its
-- charge value.
updateCustomLineItemPercentageChargeDetails_percentageValue :: Lens.Lens' UpdateCustomLineItemPercentageChargeDetails Prelude.Double
updateCustomLineItemPercentageChargeDetails_percentageValue :: Lens' UpdateCustomLineItemPercentageChargeDetails Double
updateCustomLineItemPercentageChargeDetails_percentageValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCustomLineItemPercentageChargeDetails' {Double
percentageValue :: Double
$sel:percentageValue:UpdateCustomLineItemPercentageChargeDetails' :: UpdateCustomLineItemPercentageChargeDetails -> Double
percentageValue} -> Double
percentageValue) (\s :: UpdateCustomLineItemPercentageChargeDetails
s@UpdateCustomLineItemPercentageChargeDetails' {} Double
a -> UpdateCustomLineItemPercentageChargeDetails
s {$sel:percentageValue:UpdateCustomLineItemPercentageChargeDetails' :: Double
percentageValue = Double
a} :: UpdateCustomLineItemPercentageChargeDetails)

instance
  Prelude.Hashable
    UpdateCustomLineItemPercentageChargeDetails
  where
  hashWithSalt :: Int -> UpdateCustomLineItemPercentageChargeDetails -> Int
hashWithSalt
    Int
_salt
    UpdateCustomLineItemPercentageChargeDetails' {Double
percentageValue :: Double
$sel:percentageValue:UpdateCustomLineItemPercentageChargeDetails' :: UpdateCustomLineItemPercentageChargeDetails -> Double
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
percentageValue

instance
  Prelude.NFData
    UpdateCustomLineItemPercentageChargeDetails
  where
  rnf :: UpdateCustomLineItemPercentageChargeDetails -> ()
rnf UpdateCustomLineItemPercentageChargeDetails' {Double
percentageValue :: Double
$sel:percentageValue:UpdateCustomLineItemPercentageChargeDetails' :: UpdateCustomLineItemPercentageChargeDetails -> Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Double
percentageValue

instance
  Data.ToJSON
    UpdateCustomLineItemPercentageChargeDetails
  where
  toJSON :: UpdateCustomLineItemPercentageChargeDetails -> Value
toJSON
    UpdateCustomLineItemPercentageChargeDetails' {Double
percentageValue :: Double
$sel:percentageValue:UpdateCustomLineItemPercentageChargeDetails' :: UpdateCustomLineItemPercentageChargeDetails -> Double
..} =
      [Pair] -> Value
Data.object
        ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ forall a. a -> Maybe a
Prelude.Just
                (Key
"PercentageValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
percentageValue)
            ]
        )