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

import Amazonka.Budgets.Types.Action
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The description of details of the event.
--
-- /See:/ 'newActionHistoryDetails' smart constructor.
data ActionHistoryDetails = ActionHistoryDetails'
  { ActionHistoryDetails -> Text
message :: Prelude.Text,
    -- | The budget action resource.
    ActionHistoryDetails -> Action
action :: Action
  }
  deriving (ActionHistoryDetails -> ActionHistoryDetails -> Bool
(ActionHistoryDetails -> ActionHistoryDetails -> Bool)
-> (ActionHistoryDetails -> ActionHistoryDetails -> Bool)
-> Eq ActionHistoryDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionHistoryDetails -> ActionHistoryDetails -> Bool
$c/= :: ActionHistoryDetails -> ActionHistoryDetails -> Bool
== :: ActionHistoryDetails -> ActionHistoryDetails -> Bool
$c== :: ActionHistoryDetails -> ActionHistoryDetails -> Bool
Prelude.Eq, Int -> ActionHistoryDetails -> ShowS
[ActionHistoryDetails] -> ShowS
ActionHistoryDetails -> String
(Int -> ActionHistoryDetails -> ShowS)
-> (ActionHistoryDetails -> String)
-> ([ActionHistoryDetails] -> ShowS)
-> Show ActionHistoryDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionHistoryDetails] -> ShowS
$cshowList :: [ActionHistoryDetails] -> ShowS
show :: ActionHistoryDetails -> String
$cshow :: ActionHistoryDetails -> String
showsPrec :: Int -> ActionHistoryDetails -> ShowS
$cshowsPrec :: Int -> ActionHistoryDetails -> ShowS
Prelude.Show, (forall x. ActionHistoryDetails -> Rep ActionHistoryDetails x)
-> (forall x. Rep ActionHistoryDetails x -> ActionHistoryDetails)
-> Generic ActionHistoryDetails
forall x. Rep ActionHistoryDetails x -> ActionHistoryDetails
forall x. ActionHistoryDetails -> Rep ActionHistoryDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionHistoryDetails x -> ActionHistoryDetails
$cfrom :: forall x. ActionHistoryDetails -> Rep ActionHistoryDetails x
Prelude.Generic)

-- |
-- Create a value of 'ActionHistoryDetails' 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:
--
-- 'message', 'actionHistoryDetails_message' - Undocumented member.
--
-- 'action', 'actionHistoryDetails_action' - The budget action resource.
newActionHistoryDetails ::
  -- | 'message'
  Prelude.Text ->
  -- | 'action'
  Action ->
  ActionHistoryDetails
newActionHistoryDetails :: Text -> Action -> ActionHistoryDetails
newActionHistoryDetails Text
pMessage_ Action
pAction_ =
  ActionHistoryDetails' :: Text -> Action -> ActionHistoryDetails
ActionHistoryDetails'
    { $sel:message:ActionHistoryDetails' :: Text
message = Text
pMessage_,
      $sel:action:ActionHistoryDetails' :: Action
action = Action
pAction_
    }

-- | Undocumented member.
actionHistoryDetails_message :: Lens.Lens' ActionHistoryDetails Prelude.Text
actionHistoryDetails_message :: (Text -> f Text) -> ActionHistoryDetails -> f ActionHistoryDetails
actionHistoryDetails_message = (ActionHistoryDetails -> Text)
-> (ActionHistoryDetails -> Text -> ActionHistoryDetails)
-> Lens ActionHistoryDetails ActionHistoryDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionHistoryDetails' {Text
message :: Text
$sel:message:ActionHistoryDetails' :: ActionHistoryDetails -> Text
message} -> Text
message) (\s :: ActionHistoryDetails
s@ActionHistoryDetails' {} Text
a -> ActionHistoryDetails
s {$sel:message:ActionHistoryDetails' :: Text
message = Text
a} :: ActionHistoryDetails)

-- | The budget action resource.
actionHistoryDetails_action :: Lens.Lens' ActionHistoryDetails Action
actionHistoryDetails_action :: (Action -> f Action)
-> ActionHistoryDetails -> f ActionHistoryDetails
actionHistoryDetails_action = (ActionHistoryDetails -> Action)
-> (ActionHistoryDetails -> Action -> ActionHistoryDetails)
-> Lens ActionHistoryDetails ActionHistoryDetails Action Action
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionHistoryDetails' {Action
action :: Action
$sel:action:ActionHistoryDetails' :: ActionHistoryDetails -> Action
action} -> Action
action) (\s :: ActionHistoryDetails
s@ActionHistoryDetails' {} Action
a -> ActionHistoryDetails
s {$sel:action:ActionHistoryDetails' :: Action
action = Action
a} :: ActionHistoryDetails)

instance Core.FromJSON ActionHistoryDetails where
  parseJSON :: Value -> Parser ActionHistoryDetails
parseJSON =
    String
-> (Object -> Parser ActionHistoryDetails)
-> Value
-> Parser ActionHistoryDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActionHistoryDetails"
      ( \Object
x ->
          Text -> Action -> ActionHistoryDetails
ActionHistoryDetails'
            (Text -> Action -> ActionHistoryDetails)
-> Parser Text -> Parser (Action -> ActionHistoryDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Message")
            Parser (Action -> ActionHistoryDetails)
-> Parser Action -> Parser ActionHistoryDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Action
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Action")
      )

instance Prelude.Hashable ActionHistoryDetails

instance Prelude.NFData ActionHistoryDetails