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

-- | The preferences and settings that will be used to compute the Amazon Web
-- Services charges for a billing group.
--
-- /See:/ 'newComputationPreference' smart constructor.
data ComputationPreference = ComputationPreference'
  { -- | The Amazon Resource Name (ARN) of the pricing plan that\'s used to
    -- compute the Amazon Web Services charges for a billing group.
    ComputationPreference -> Text
pricingPlanArn :: Prelude.Text
  }
  deriving (ComputationPreference -> ComputationPreference -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComputationPreference -> ComputationPreference -> Bool
$c/= :: ComputationPreference -> ComputationPreference -> Bool
== :: ComputationPreference -> ComputationPreference -> Bool
$c== :: ComputationPreference -> ComputationPreference -> Bool
Prelude.Eq, ReadPrec [ComputationPreference]
ReadPrec ComputationPreference
Int -> ReadS ComputationPreference
ReadS [ComputationPreference]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComputationPreference]
$creadListPrec :: ReadPrec [ComputationPreference]
readPrec :: ReadPrec ComputationPreference
$creadPrec :: ReadPrec ComputationPreference
readList :: ReadS [ComputationPreference]
$creadList :: ReadS [ComputationPreference]
readsPrec :: Int -> ReadS ComputationPreference
$creadsPrec :: Int -> ReadS ComputationPreference
Prelude.Read, Int -> ComputationPreference -> ShowS
[ComputationPreference] -> ShowS
ComputationPreference -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComputationPreference] -> ShowS
$cshowList :: [ComputationPreference] -> ShowS
show :: ComputationPreference -> String
$cshow :: ComputationPreference -> String
showsPrec :: Int -> ComputationPreference -> ShowS
$cshowsPrec :: Int -> ComputationPreference -> ShowS
Prelude.Show, forall x. Rep ComputationPreference x -> ComputationPreference
forall x. ComputationPreference -> Rep ComputationPreference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComputationPreference x -> ComputationPreference
$cfrom :: forall x. ComputationPreference -> Rep ComputationPreference x
Prelude.Generic)

-- |
-- Create a value of 'ComputationPreference' 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:
--
-- 'pricingPlanArn', 'computationPreference_pricingPlanArn' - The Amazon Resource Name (ARN) of the pricing plan that\'s used to
-- compute the Amazon Web Services charges for a billing group.
newComputationPreference ::
  -- | 'pricingPlanArn'
  Prelude.Text ->
  ComputationPreference
newComputationPreference :: Text -> ComputationPreference
newComputationPreference Text
pPricingPlanArn_ =
  ComputationPreference'
    { $sel:pricingPlanArn:ComputationPreference' :: Text
pricingPlanArn =
        Text
pPricingPlanArn_
    }

-- | The Amazon Resource Name (ARN) of the pricing plan that\'s used to
-- compute the Amazon Web Services charges for a billing group.
computationPreference_pricingPlanArn :: Lens.Lens' ComputationPreference Prelude.Text
computationPreference_pricingPlanArn :: Lens' ComputationPreference Text
computationPreference_pricingPlanArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputationPreference' {Text
pricingPlanArn :: Text
$sel:pricingPlanArn:ComputationPreference' :: ComputationPreference -> Text
pricingPlanArn} -> Text
pricingPlanArn) (\s :: ComputationPreference
s@ComputationPreference' {} Text
a -> ComputationPreference
s {$sel:pricingPlanArn:ComputationPreference' :: Text
pricingPlanArn = Text
a} :: ComputationPreference)

instance Data.FromJSON ComputationPreference where
  parseJSON :: Value -> Parser ComputationPreference
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ComputationPreference"
      ( \Object
x ->
          Text -> ComputationPreference
ComputationPreference'
            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
"PricingPlanArn")
      )

instance Prelude.Hashable ComputationPreference where
  hashWithSalt :: Int -> ComputationPreference -> Int
hashWithSalt Int
_salt ComputationPreference' {Text
pricingPlanArn :: Text
$sel:pricingPlanArn:ComputationPreference' :: ComputationPreference -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
pricingPlanArn

instance Prelude.NFData ComputationPreference where
  rnf :: ComputationPreference -> ()
rnf ComputationPreference' {Text
pricingPlanArn :: Text
$sel:pricingPlanArn:ComputationPreference' :: ComputationPreference -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
pricingPlanArn

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