{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | 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,
    -- | The time period that\'s covered by this budget comparison.
    BudgetedAndActualAmounts -> Maybe TimePeriod
timePeriod :: Prelude.Maybe TimePeriod
  }
  deriving (BudgetedAndActualAmounts -> BudgetedAndActualAmounts -> Bool
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]
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
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.
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:
--
-- '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.
--
-- 'timePeriod', 'budgetedAndActualAmounts_timePeriod' - The time period that\'s covered by this budget comparison.
newBudgetedAndActualAmounts ::
  BudgetedAndActualAmounts
newBudgetedAndActualAmounts :: BudgetedAndActualAmounts
newBudgetedAndActualAmounts =
  BudgetedAndActualAmounts'
    { $sel:actualAmount:BudgetedAndActualAmounts' :: Maybe Spend
actualAmount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:budgetedAmount:BudgetedAndActualAmounts' :: Maybe Spend
budgetedAmount = forall a. Maybe a
Prelude.Nothing,
      $sel:timePeriod:BudgetedAndActualAmounts' :: Maybe TimePeriod
timePeriod = forall a. Maybe a
Prelude.Nothing
    }

-- | Your actual costs or usage for a budget period.
budgetedAndActualAmounts_actualAmount :: Lens.Lens' BudgetedAndActualAmounts (Prelude.Maybe Spend)
budgetedAndActualAmounts_actualAmount :: Lens' BudgetedAndActualAmounts (Maybe Spend)
budgetedAndActualAmounts_actualAmount = 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 :: Lens' BudgetedAndActualAmounts (Maybe Spend)
budgetedAndActualAmounts_budgetedAmount = 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)

-- | The time period that\'s covered by this budget comparison.
budgetedAndActualAmounts_timePeriod :: Lens.Lens' BudgetedAndActualAmounts (Prelude.Maybe TimePeriod)
budgetedAndActualAmounts_timePeriod :: Lens' BudgetedAndActualAmounts (Maybe TimePeriod)
budgetedAndActualAmounts_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)

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

instance Prelude.Hashable BudgetedAndActualAmounts where
  hashWithSalt :: Int -> BudgetedAndActualAmounts -> Int
hashWithSalt Int
_salt BudgetedAndActualAmounts' {Maybe Spend
Maybe TimePeriod
timePeriod :: Maybe TimePeriod
budgetedAmount :: Maybe Spend
actualAmount :: Maybe Spend
$sel:timePeriod:BudgetedAndActualAmounts' :: BudgetedAndActualAmounts -> Maybe TimePeriod
$sel:budgetedAmount:BudgetedAndActualAmounts' :: BudgetedAndActualAmounts -> Maybe Spend
$sel:actualAmount:BudgetedAndActualAmounts' :: BudgetedAndActualAmounts -> Maybe Spend
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Spend
actualAmount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Spend
budgetedAmount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TimePeriod
timePeriod

instance Prelude.NFData BudgetedAndActualAmounts where
  rnf :: BudgetedAndActualAmounts -> ()
rnf BudgetedAndActualAmounts' {Maybe Spend
Maybe TimePeriod
timePeriod :: Maybe TimePeriod
budgetedAmount :: Maybe Spend
actualAmount :: Maybe Spend
$sel:timePeriod:BudgetedAndActualAmounts' :: BudgetedAndActualAmounts -> Maybe TimePeriod
$sel:budgetedAmount:BudgetedAndActualAmounts' :: BudgetedAndActualAmounts -> Maybe Spend
$sel:actualAmount:BudgetedAndActualAmounts' :: BudgetedAndActualAmounts -> Maybe Spend
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Spend
actualAmount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Spend
budgetedAmount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TimePeriod
timePeriod