{-# 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.BudgetNotificationsForAccount
-- 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.BudgetNotificationsForAccount where

import Amazonka.Budgets.Types.Notification
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 budget name and associated notifications for an account.
--
-- /See:/ 'newBudgetNotificationsForAccount' smart constructor.
data BudgetNotificationsForAccount = BudgetNotificationsForAccount'
  { BudgetNotificationsForAccount -> Maybe Text
budgetName :: Prelude.Maybe Prelude.Text,
    BudgetNotificationsForAccount -> Maybe [Notification]
notifications :: Prelude.Maybe [Notification]
  }
  deriving (BudgetNotificationsForAccount
-> BudgetNotificationsForAccount -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BudgetNotificationsForAccount
-> BudgetNotificationsForAccount -> Bool
$c/= :: BudgetNotificationsForAccount
-> BudgetNotificationsForAccount -> Bool
== :: BudgetNotificationsForAccount
-> BudgetNotificationsForAccount -> Bool
$c== :: BudgetNotificationsForAccount
-> BudgetNotificationsForAccount -> Bool
Prelude.Eq, ReadPrec [BudgetNotificationsForAccount]
ReadPrec BudgetNotificationsForAccount
Int -> ReadS BudgetNotificationsForAccount
ReadS [BudgetNotificationsForAccount]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BudgetNotificationsForAccount]
$creadListPrec :: ReadPrec [BudgetNotificationsForAccount]
readPrec :: ReadPrec BudgetNotificationsForAccount
$creadPrec :: ReadPrec BudgetNotificationsForAccount
readList :: ReadS [BudgetNotificationsForAccount]
$creadList :: ReadS [BudgetNotificationsForAccount]
readsPrec :: Int -> ReadS BudgetNotificationsForAccount
$creadsPrec :: Int -> ReadS BudgetNotificationsForAccount
Prelude.Read, Int -> BudgetNotificationsForAccount -> ShowS
[BudgetNotificationsForAccount] -> ShowS
BudgetNotificationsForAccount -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BudgetNotificationsForAccount] -> ShowS
$cshowList :: [BudgetNotificationsForAccount] -> ShowS
show :: BudgetNotificationsForAccount -> String
$cshow :: BudgetNotificationsForAccount -> String
showsPrec :: Int -> BudgetNotificationsForAccount -> ShowS
$cshowsPrec :: Int -> BudgetNotificationsForAccount -> ShowS
Prelude.Show, forall x.
Rep BudgetNotificationsForAccount x
-> BudgetNotificationsForAccount
forall x.
BudgetNotificationsForAccount
-> Rep BudgetNotificationsForAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BudgetNotificationsForAccount x
-> BudgetNotificationsForAccount
$cfrom :: forall x.
BudgetNotificationsForAccount
-> Rep BudgetNotificationsForAccount x
Prelude.Generic)

-- |
-- Create a value of 'BudgetNotificationsForAccount' 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:
--
-- 'budgetName', 'budgetNotificationsForAccount_budgetName' - Undocumented member.
--
-- 'notifications', 'budgetNotificationsForAccount_notifications' - Undocumented member.
newBudgetNotificationsForAccount ::
  BudgetNotificationsForAccount
newBudgetNotificationsForAccount :: BudgetNotificationsForAccount
newBudgetNotificationsForAccount =
  BudgetNotificationsForAccount'
    { $sel:budgetName:BudgetNotificationsForAccount' :: Maybe Text
budgetName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:notifications:BudgetNotificationsForAccount' :: Maybe [Notification]
notifications = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
budgetNotificationsForAccount_budgetName :: Lens.Lens' BudgetNotificationsForAccount (Prelude.Maybe Prelude.Text)
budgetNotificationsForAccount_budgetName :: Lens' BudgetNotificationsForAccount (Maybe Text)
budgetNotificationsForAccount_budgetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BudgetNotificationsForAccount' {Maybe Text
budgetName :: Maybe Text
$sel:budgetName:BudgetNotificationsForAccount' :: BudgetNotificationsForAccount -> Maybe Text
budgetName} -> Maybe Text
budgetName) (\s :: BudgetNotificationsForAccount
s@BudgetNotificationsForAccount' {} Maybe Text
a -> BudgetNotificationsForAccount
s {$sel:budgetName:BudgetNotificationsForAccount' :: Maybe Text
budgetName = Maybe Text
a} :: BudgetNotificationsForAccount)

-- | Undocumented member.
budgetNotificationsForAccount_notifications :: Lens.Lens' BudgetNotificationsForAccount (Prelude.Maybe [Notification])
budgetNotificationsForAccount_notifications :: Lens' BudgetNotificationsForAccount (Maybe [Notification])
budgetNotificationsForAccount_notifications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BudgetNotificationsForAccount' {Maybe [Notification]
notifications :: Maybe [Notification]
$sel:notifications:BudgetNotificationsForAccount' :: BudgetNotificationsForAccount -> Maybe [Notification]
notifications} -> Maybe [Notification]
notifications) (\s :: BudgetNotificationsForAccount
s@BudgetNotificationsForAccount' {} Maybe [Notification]
a -> BudgetNotificationsForAccount
s {$sel:notifications:BudgetNotificationsForAccount' :: Maybe [Notification]
notifications = Maybe [Notification]
a} :: BudgetNotificationsForAccount) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON BudgetNotificationsForAccount where
  parseJSON :: Value -> Parser BudgetNotificationsForAccount
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BudgetNotificationsForAccount"
      ( \Object
x ->
          Maybe Text -> Maybe [Notification] -> BudgetNotificationsForAccount
BudgetNotificationsForAccount'
            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
"BudgetName")
            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
"Notifications" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    BudgetNotificationsForAccount
  where
  hashWithSalt :: Int -> BudgetNotificationsForAccount -> Int
hashWithSalt Int
_salt BudgetNotificationsForAccount' {Maybe [Notification]
Maybe Text
notifications :: Maybe [Notification]
budgetName :: Maybe Text
$sel:notifications:BudgetNotificationsForAccount' :: BudgetNotificationsForAccount -> Maybe [Notification]
$sel:budgetName:BudgetNotificationsForAccount' :: BudgetNotificationsForAccount -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
budgetName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Notification]
notifications

instance Prelude.NFData BudgetNotificationsForAccount where
  rnf :: BudgetNotificationsForAccount -> ()
rnf BudgetNotificationsForAccount' {Maybe [Notification]
Maybe Text
notifications :: Maybe [Notification]
budgetName :: Maybe Text
$sel:notifications:BudgetNotificationsForAccount' :: BudgetNotificationsForAccount -> Maybe [Notification]
$sel:budgetName:BudgetNotificationsForAccount' :: BudgetNotificationsForAccount -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
budgetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Notification]
notifications