{-# 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.CostExplorer.Types.SavingsPlansAmortizedCommitment
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CostExplorer.Types.SavingsPlansAmortizedCommitment where

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

-- | The amortized amount of Savings Plans purchased in a specific account
-- during a specific time interval.
--
-- /See:/ 'newSavingsPlansAmortizedCommitment' smart constructor.
data SavingsPlansAmortizedCommitment = SavingsPlansAmortizedCommitment'
  { -- | The amortized amount of your Savings Plans commitment that was purchased
    -- with an @Upfront@ or @PartialUpfront@ Savings Plans.
    SavingsPlansAmortizedCommitment -> Maybe Text
amortizedUpfrontCommitment :: Prelude.Maybe Prelude.Text,
    -- | The total amortized amount of your Savings Plans commitment, regardless
    -- of your Savings Plans purchase method.
    SavingsPlansAmortizedCommitment -> Maybe Text
totalAmortizedCommitment :: Prelude.Maybe Prelude.Text,
    -- | The amortized amount of your Savings Plans commitment that was purchased
    -- with either a @Partial@ or a @NoUpfront@.
    SavingsPlansAmortizedCommitment -> Maybe Text
amortizedRecurringCommitment :: Prelude.Maybe Prelude.Text
  }
  deriving (SavingsPlansAmortizedCommitment
-> SavingsPlansAmortizedCommitment -> Bool
(SavingsPlansAmortizedCommitment
 -> SavingsPlansAmortizedCommitment -> Bool)
-> (SavingsPlansAmortizedCommitment
    -> SavingsPlansAmortizedCommitment -> Bool)
-> Eq SavingsPlansAmortizedCommitment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SavingsPlansAmortizedCommitment
-> SavingsPlansAmortizedCommitment -> Bool
$c/= :: SavingsPlansAmortizedCommitment
-> SavingsPlansAmortizedCommitment -> Bool
== :: SavingsPlansAmortizedCommitment
-> SavingsPlansAmortizedCommitment -> Bool
$c== :: SavingsPlansAmortizedCommitment
-> SavingsPlansAmortizedCommitment -> Bool
Prelude.Eq, ReadPrec [SavingsPlansAmortizedCommitment]
ReadPrec SavingsPlansAmortizedCommitment
Int -> ReadS SavingsPlansAmortizedCommitment
ReadS [SavingsPlansAmortizedCommitment]
(Int -> ReadS SavingsPlansAmortizedCommitment)
-> ReadS [SavingsPlansAmortizedCommitment]
-> ReadPrec SavingsPlansAmortizedCommitment
-> ReadPrec [SavingsPlansAmortizedCommitment]
-> Read SavingsPlansAmortizedCommitment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SavingsPlansAmortizedCommitment]
$creadListPrec :: ReadPrec [SavingsPlansAmortizedCommitment]
readPrec :: ReadPrec SavingsPlansAmortizedCommitment
$creadPrec :: ReadPrec SavingsPlansAmortizedCommitment
readList :: ReadS [SavingsPlansAmortizedCommitment]
$creadList :: ReadS [SavingsPlansAmortizedCommitment]
readsPrec :: Int -> ReadS SavingsPlansAmortizedCommitment
$creadsPrec :: Int -> ReadS SavingsPlansAmortizedCommitment
Prelude.Read, Int -> SavingsPlansAmortizedCommitment -> ShowS
[SavingsPlansAmortizedCommitment] -> ShowS
SavingsPlansAmortizedCommitment -> String
(Int -> SavingsPlansAmortizedCommitment -> ShowS)
-> (SavingsPlansAmortizedCommitment -> String)
-> ([SavingsPlansAmortizedCommitment] -> ShowS)
-> Show SavingsPlansAmortizedCommitment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SavingsPlansAmortizedCommitment] -> ShowS
$cshowList :: [SavingsPlansAmortizedCommitment] -> ShowS
show :: SavingsPlansAmortizedCommitment -> String
$cshow :: SavingsPlansAmortizedCommitment -> String
showsPrec :: Int -> SavingsPlansAmortizedCommitment -> ShowS
$cshowsPrec :: Int -> SavingsPlansAmortizedCommitment -> ShowS
Prelude.Show, (forall x.
 SavingsPlansAmortizedCommitment
 -> Rep SavingsPlansAmortizedCommitment x)
-> (forall x.
    Rep SavingsPlansAmortizedCommitment x
    -> SavingsPlansAmortizedCommitment)
-> Generic SavingsPlansAmortizedCommitment
forall x.
Rep SavingsPlansAmortizedCommitment x
-> SavingsPlansAmortizedCommitment
forall x.
SavingsPlansAmortizedCommitment
-> Rep SavingsPlansAmortizedCommitment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SavingsPlansAmortizedCommitment x
-> SavingsPlansAmortizedCommitment
$cfrom :: forall x.
SavingsPlansAmortizedCommitment
-> Rep SavingsPlansAmortizedCommitment x
Prelude.Generic)

-- |
-- Create a value of 'SavingsPlansAmortizedCommitment' 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:
--
-- 'amortizedUpfrontCommitment', 'savingsPlansAmortizedCommitment_amortizedUpfrontCommitment' - The amortized amount of your Savings Plans commitment that was purchased
-- with an @Upfront@ or @PartialUpfront@ Savings Plans.
--
-- 'totalAmortizedCommitment', 'savingsPlansAmortizedCommitment_totalAmortizedCommitment' - The total amortized amount of your Savings Plans commitment, regardless
-- of your Savings Plans purchase method.
--
-- 'amortizedRecurringCommitment', 'savingsPlansAmortizedCommitment_amortizedRecurringCommitment' - The amortized amount of your Savings Plans commitment that was purchased
-- with either a @Partial@ or a @NoUpfront@.
newSavingsPlansAmortizedCommitment ::
  SavingsPlansAmortizedCommitment
newSavingsPlansAmortizedCommitment :: SavingsPlansAmortizedCommitment
newSavingsPlansAmortizedCommitment =
  SavingsPlansAmortizedCommitment' :: Maybe Text
-> Maybe Text -> Maybe Text -> SavingsPlansAmortizedCommitment
SavingsPlansAmortizedCommitment'
    { $sel:amortizedUpfrontCommitment:SavingsPlansAmortizedCommitment' :: Maybe Text
amortizedUpfrontCommitment =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:totalAmortizedCommitment:SavingsPlansAmortizedCommitment' :: Maybe Text
totalAmortizedCommitment = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:amortizedRecurringCommitment:SavingsPlansAmortizedCommitment' :: Maybe Text
amortizedRecurringCommitment =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The amortized amount of your Savings Plans commitment that was purchased
-- with an @Upfront@ or @PartialUpfront@ Savings Plans.
savingsPlansAmortizedCommitment_amortizedUpfrontCommitment :: Lens.Lens' SavingsPlansAmortizedCommitment (Prelude.Maybe Prelude.Text)
savingsPlansAmortizedCommitment_amortizedUpfrontCommitment :: (Maybe Text -> f (Maybe Text))
-> SavingsPlansAmortizedCommitment
-> f SavingsPlansAmortizedCommitment
savingsPlansAmortizedCommitment_amortizedUpfrontCommitment = (SavingsPlansAmortizedCommitment -> Maybe Text)
-> (SavingsPlansAmortizedCommitment
    -> Maybe Text -> SavingsPlansAmortizedCommitment)
-> Lens
     SavingsPlansAmortizedCommitment
     SavingsPlansAmortizedCommitment
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlansAmortizedCommitment' {Maybe Text
amortizedUpfrontCommitment :: Maybe Text
$sel:amortizedUpfrontCommitment:SavingsPlansAmortizedCommitment' :: SavingsPlansAmortizedCommitment -> Maybe Text
amortizedUpfrontCommitment} -> Maybe Text
amortizedUpfrontCommitment) (\s :: SavingsPlansAmortizedCommitment
s@SavingsPlansAmortizedCommitment' {} Maybe Text
a -> SavingsPlansAmortizedCommitment
s {$sel:amortizedUpfrontCommitment:SavingsPlansAmortizedCommitment' :: Maybe Text
amortizedUpfrontCommitment = Maybe Text
a} :: SavingsPlansAmortizedCommitment)

-- | The total amortized amount of your Savings Plans commitment, regardless
-- of your Savings Plans purchase method.
savingsPlansAmortizedCommitment_totalAmortizedCommitment :: Lens.Lens' SavingsPlansAmortizedCommitment (Prelude.Maybe Prelude.Text)
savingsPlansAmortizedCommitment_totalAmortizedCommitment :: (Maybe Text -> f (Maybe Text))
-> SavingsPlansAmortizedCommitment
-> f SavingsPlansAmortizedCommitment
savingsPlansAmortizedCommitment_totalAmortizedCommitment = (SavingsPlansAmortizedCommitment -> Maybe Text)
-> (SavingsPlansAmortizedCommitment
    -> Maybe Text -> SavingsPlansAmortizedCommitment)
-> Lens
     SavingsPlansAmortizedCommitment
     SavingsPlansAmortizedCommitment
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlansAmortizedCommitment' {Maybe Text
totalAmortizedCommitment :: Maybe Text
$sel:totalAmortizedCommitment:SavingsPlansAmortizedCommitment' :: SavingsPlansAmortizedCommitment -> Maybe Text
totalAmortizedCommitment} -> Maybe Text
totalAmortizedCommitment) (\s :: SavingsPlansAmortizedCommitment
s@SavingsPlansAmortizedCommitment' {} Maybe Text
a -> SavingsPlansAmortizedCommitment
s {$sel:totalAmortizedCommitment:SavingsPlansAmortizedCommitment' :: Maybe Text
totalAmortizedCommitment = Maybe Text
a} :: SavingsPlansAmortizedCommitment)

-- | The amortized amount of your Savings Plans commitment that was purchased
-- with either a @Partial@ or a @NoUpfront@.
savingsPlansAmortizedCommitment_amortizedRecurringCommitment :: Lens.Lens' SavingsPlansAmortizedCommitment (Prelude.Maybe Prelude.Text)
savingsPlansAmortizedCommitment_amortizedRecurringCommitment :: (Maybe Text -> f (Maybe Text))
-> SavingsPlansAmortizedCommitment
-> f SavingsPlansAmortizedCommitment
savingsPlansAmortizedCommitment_amortizedRecurringCommitment = (SavingsPlansAmortizedCommitment -> Maybe Text)
-> (SavingsPlansAmortizedCommitment
    -> Maybe Text -> SavingsPlansAmortizedCommitment)
-> Lens
     SavingsPlansAmortizedCommitment
     SavingsPlansAmortizedCommitment
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlansAmortizedCommitment' {Maybe Text
amortizedRecurringCommitment :: Maybe Text
$sel:amortizedRecurringCommitment:SavingsPlansAmortizedCommitment' :: SavingsPlansAmortizedCommitment -> Maybe Text
amortizedRecurringCommitment} -> Maybe Text
amortizedRecurringCommitment) (\s :: SavingsPlansAmortizedCommitment
s@SavingsPlansAmortizedCommitment' {} Maybe Text
a -> SavingsPlansAmortizedCommitment
s {$sel:amortizedRecurringCommitment:SavingsPlansAmortizedCommitment' :: Maybe Text
amortizedRecurringCommitment = Maybe Text
a} :: SavingsPlansAmortizedCommitment)

instance
  Core.FromJSON
    SavingsPlansAmortizedCommitment
  where
  parseJSON :: Value -> Parser SavingsPlansAmortizedCommitment
parseJSON =
    String
-> (Object -> Parser SavingsPlansAmortizedCommitment)
-> Value
-> Parser SavingsPlansAmortizedCommitment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SavingsPlansAmortizedCommitment"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> SavingsPlansAmortizedCommitment
SavingsPlansAmortizedCommitment'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> SavingsPlansAmortizedCommitment)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> SavingsPlansAmortizedCommitment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AmortizedUpfrontCommitment")
            Parser
  (Maybe Text -> Maybe Text -> SavingsPlansAmortizedCommitment)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> SavingsPlansAmortizedCommitment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TotalAmortizedCommitment")
            Parser (Maybe Text -> SavingsPlansAmortizedCommitment)
-> Parser (Maybe Text) -> Parser SavingsPlansAmortizedCommitment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AmortizedRecurringCommitment")
      )

instance
  Prelude.Hashable
    SavingsPlansAmortizedCommitment

instance
  Prelude.NFData
    SavingsPlansAmortizedCommitment