{-# 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.Budgets.Types.BudgetedAndActualAmounts
-- 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.Budgets.Types.BudgetedAndActualAmounts where

import Amazonka.Budgets.Types.Spend
import Amazonka.Budgets.Types.TimePeriod
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The amount of cost or usage that you created the budget for, compared to
-- your actual costs or usage.
--
-- /See:/ 'newBudgetedAndActualAmounts' smart constructor.
data BudgetedAndActualAmounts = BudgetedAndActualAmounts'
  { -- | The time period covered by this budget comparison.
    BudgetedAndActualAmounts -> Maybe TimePeriod
timePeriod :: Prelude.Maybe TimePeriod,
    -- | Your actual costs or usage for a budget period.
    BudgetedAndActualAmounts -> Maybe Spend
actualAmount :: Prelude.Maybe Spend,
    -- | The amount of cost or usage that you created the budget for.
    BudgetedAndActualAmounts -> Maybe Spend
budgetedAmount :: Prelude.Maybe Spend
  }
  deriving (BudgetedAndActualAmounts -> BudgetedAndActualAmounts -> Bool
(BudgetedAndActualAmounts -> BudgetedAndActualAmounts -> Bool)
-> (BudgetedAndActualAmounts -> BudgetedAndActualAmounts -> Bool)
-> Eq BudgetedAndActualAmounts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BudgetedAndActualAmounts -> BudgetedAndActualAmounts -> Bool
$c/= :: BudgetedAndActualAmounts -> BudgetedAndActualAmounts -> Bool
== :: BudgetedAndActualAmounts -> BudgetedAndActualAmounts -> Bool
$c== :: BudgetedAndActualAmounts -> BudgetedAndActualAmounts -> Bool
Prelude.Eq, ReadPrec [BudgetedAndActualAmounts]
ReadPrec BudgetedAndActualAmounts
Int -> ReadS BudgetedAndActualAmounts
ReadS [BudgetedAndActualAmounts]
(Int -> ReadS BudgetedAndActualAmounts)
-> ReadS [BudgetedAndActualAmounts]
-> ReadPrec BudgetedAndActualAmounts
-> ReadPrec [BudgetedAndActualAmounts]
-> Read BudgetedAndActualAmounts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BudgetedAndActualAmounts]
$creadListPrec :: ReadPrec [BudgetedAndActualAmounts]
readPrec :: ReadPrec BudgetedAndActualAmounts
$creadPrec :: ReadPrec BudgetedAndActualAmounts
readList :: ReadS [BudgetedAndActualAmounts]
$creadList :: ReadS [BudgetedAndActualAmounts]
readsPrec :: Int -> ReadS BudgetedAndActualAmounts
$creadsPrec :: Int -> ReadS BudgetedAndActualAmounts
Prelude.Read, Int -> BudgetedAndActualAmounts -> ShowS
[BudgetedAndActualAmounts] -> ShowS
BudgetedAndActualAmounts -> String
(Int -> BudgetedAndActualAmounts -> ShowS)
-> (BudgetedAndActualAmounts -> String)
-> ([BudgetedAndActualAmounts] -> ShowS)
-> Show BudgetedAndActualAmounts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BudgetedAndActualAmounts] -> ShowS
$cshowList :: [BudgetedAndActualAmounts] -> ShowS
show :: BudgetedAndActualAmounts -> String
$cshow :: BudgetedAndActualAmounts -> String
showsPrec :: Int -> BudgetedAndActualAmounts -> ShowS
$cshowsPrec :: Int -> BudgetedAndActualAmounts -> ShowS
Prelude.Show, (forall x.
 BudgetedAndActualAmounts -> Rep BudgetedAndActualAmounts x)
-> (forall x.
    Rep BudgetedAndActualAmounts x -> BudgetedAndActualAmounts)
-> Generic BudgetedAndActualAmounts
forall x.
Rep BudgetedAndActualAmounts x -> BudgetedAndActualAmounts
forall x.
BudgetedAndActualAmounts -> Rep BudgetedAndActualAmounts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BudgetedAndActualAmounts x -> BudgetedAndActualAmounts
$cfrom :: forall x.
BudgetedAndActualAmounts -> Rep BudgetedAndActualAmounts x
Prelude.Generic)

-- |
-- Create a value of 'BudgetedAndActualAmounts' 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:
--
-- 'timePeriod', 'budgetedAndActualAmounts_timePeriod' - The time period covered by this budget comparison.
--
-- 'actualAmount', 'budgetedAndActualAmounts_actualAmount' - Your actual costs or usage for a budget period.
--
-- 'budgetedAmount', 'budgetedAndActualAmounts_budgetedAmount' - The amount of cost or usage that you created the budget for.
newBudgetedAndActualAmounts ::
  BudgetedAndActualAmounts
newBudgetedAndActualAmounts :: BudgetedAndActualAmounts
newBudgetedAndActualAmounts =
  BudgetedAndActualAmounts' :: Maybe TimePeriod
-> Maybe Spend -> Maybe Spend -> BudgetedAndActualAmounts
BudgetedAndActualAmounts'
    { $sel:timePeriod:BudgetedAndActualAmounts' :: Maybe TimePeriod
timePeriod =
        Maybe TimePeriod
forall a. Maybe a
Prelude.Nothing,
      $sel:actualAmount:BudgetedAndActualAmounts' :: Maybe Spend
actualAmount = Maybe Spend
forall a. Maybe a
Prelude.Nothing,
      $sel:budgetedAmount:BudgetedAndActualAmounts' :: Maybe Spend
budgetedAmount = Maybe Spend
forall a. Maybe a
Prelude.Nothing
    }

-- | The time period covered by this budget comparison.
budgetedAndActualAmounts_timePeriod :: Lens.Lens' BudgetedAndActualAmounts (Prelude.Maybe TimePeriod)
budgetedAndActualAmounts_timePeriod :: (Maybe TimePeriod -> f (Maybe TimePeriod))
-> BudgetedAndActualAmounts -> f BudgetedAndActualAmounts
budgetedAndActualAmounts_timePeriod = (BudgetedAndActualAmounts -> Maybe TimePeriod)
-> (BudgetedAndActualAmounts
    -> Maybe TimePeriod -> BudgetedAndActualAmounts)
-> Lens
     BudgetedAndActualAmounts
     BudgetedAndActualAmounts
     (Maybe TimePeriod)
     (Maybe TimePeriod)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BudgetedAndActualAmounts' {Maybe TimePeriod
timePeriod :: Maybe TimePeriod
$sel:timePeriod:BudgetedAndActualAmounts' :: BudgetedAndActualAmounts -> Maybe TimePeriod
timePeriod} -> Maybe TimePeriod
timePeriod) (\s :: BudgetedAndActualAmounts
s@BudgetedAndActualAmounts' {} Maybe TimePeriod
a -> BudgetedAndActualAmounts
s {$sel:timePeriod:BudgetedAndActualAmounts' :: Maybe TimePeriod
timePeriod = Maybe TimePeriod
a} :: BudgetedAndActualAmounts)

-- | Your actual costs or usage for a budget period.
budgetedAndActualAmounts_actualAmount :: Lens.Lens' BudgetedAndActualAmounts (Prelude.Maybe Spend)
budgetedAndActualAmounts_actualAmount :: (Maybe Spend -> f (Maybe Spend))
-> BudgetedAndActualAmounts -> f BudgetedAndActualAmounts
budgetedAndActualAmounts_actualAmount = (BudgetedAndActualAmounts -> Maybe Spend)
-> (BudgetedAndActualAmounts
    -> Maybe Spend -> BudgetedAndActualAmounts)
-> Lens
     BudgetedAndActualAmounts
     BudgetedAndActualAmounts
     (Maybe Spend)
     (Maybe Spend)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BudgetedAndActualAmounts' {Maybe Spend
actualAmount :: Maybe Spend
$sel:actualAmount:BudgetedAndActualAmounts' :: BudgetedAndActualAmounts -> Maybe Spend
actualAmount} -> Maybe Spend
actualAmount) (\s :: BudgetedAndActualAmounts
s@BudgetedAndActualAmounts' {} Maybe Spend
a -> BudgetedAndActualAmounts
s {$sel:actualAmount:BudgetedAndActualAmounts' :: Maybe Spend
actualAmount = Maybe Spend
a} :: BudgetedAndActualAmounts)

-- | The amount of cost or usage that you created the budget for.
budgetedAndActualAmounts_budgetedAmount :: Lens.Lens' BudgetedAndActualAmounts (Prelude.Maybe Spend)
budgetedAndActualAmounts_budgetedAmount :: (Maybe Spend -> f (Maybe Spend))
-> BudgetedAndActualAmounts -> f BudgetedAndActualAmounts
budgetedAndActualAmounts_budgetedAmount = (BudgetedAndActualAmounts -> Maybe Spend)
-> (BudgetedAndActualAmounts
    -> Maybe Spend -> BudgetedAndActualAmounts)
-> Lens
     BudgetedAndActualAmounts
     BudgetedAndActualAmounts
     (Maybe Spend)
     (Maybe Spend)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BudgetedAndActualAmounts' {Maybe Spend
budgetedAmount :: Maybe Spend
$sel:budgetedAmount:BudgetedAndActualAmounts' :: BudgetedAndActualAmounts -> Maybe Spend
budgetedAmount} -> Maybe Spend
budgetedAmount) (\s :: BudgetedAndActualAmounts
s@BudgetedAndActualAmounts' {} Maybe Spend
a -> BudgetedAndActualAmounts
s {$sel:budgetedAmount:BudgetedAndActualAmounts' :: Maybe Spend
budgetedAmount = Maybe Spend
a} :: BudgetedAndActualAmounts)

instance Core.FromJSON BudgetedAndActualAmounts where
  parseJSON :: Value -> Parser BudgetedAndActualAmounts
parseJSON =
    String
-> (Object -> Parser BudgetedAndActualAmounts)
-> Value
-> Parser BudgetedAndActualAmounts
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BudgetedAndActualAmounts"
      ( \Object
x ->
          Maybe TimePeriod
-> Maybe Spend -> Maybe Spend -> BudgetedAndActualAmounts
BudgetedAndActualAmounts'
            (Maybe TimePeriod
 -> Maybe Spend -> Maybe Spend -> BudgetedAndActualAmounts)
-> Parser (Maybe TimePeriod)
-> Parser (Maybe Spend -> Maybe Spend -> BudgetedAndActualAmounts)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TimePeriod)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TimePeriod")
            Parser (Maybe Spend -> Maybe Spend -> BudgetedAndActualAmounts)
-> Parser (Maybe Spend)
-> Parser (Maybe Spend -> BudgetedAndActualAmounts)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Spend)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ActualAmount")
            Parser (Maybe Spend -> BudgetedAndActualAmounts)
-> Parser (Maybe Spend) -> Parser BudgetedAndActualAmounts
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Spend)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BudgetedAmount")
      )

instance Prelude.Hashable BudgetedAndActualAmounts

instance Prelude.NFData BudgetedAndActualAmounts