{-# 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.IoTEventsData.Types.CustomerAction
-- 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.IoTEventsData.Types.CustomerAction where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTEventsData.Types.AcknowledgeActionConfiguration
import Amazonka.IoTEventsData.Types.CustomerActionName
import Amazonka.IoTEventsData.Types.DisableActionConfiguration
import Amazonka.IoTEventsData.Types.EnableActionConfiguration
import Amazonka.IoTEventsData.Types.ResetActionConfiguration
import Amazonka.IoTEventsData.Types.SnoozeActionConfiguration
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the action that you can take to respond to
-- the alarm.
--
-- /See:/ 'newCustomerAction' smart constructor.
data CustomerAction = CustomerAction'
  { -- | Contains the configuration information of an acknowledge action.
    CustomerAction -> Maybe AcknowledgeActionConfiguration
acknowledgeActionConfiguration :: Prelude.Maybe AcknowledgeActionConfiguration,
    -- | The name of the action. The action name can be one of the following
    -- values:
    --
    -- -   @SNOOZE@ - When you snooze the alarm, the alarm state changes to
    --     @SNOOZE_DISABLED@.
    --
    -- -   @ENABLE@ - When you enable the alarm, the alarm state changes to
    --     @NORMAL@.
    --
    -- -   @DISABLE@ - When you disable the alarm, the alarm state changes to
    --     @DISABLED@.
    --
    -- -   @ACKNOWLEDGE@ - When you acknowledge the alarm, the alarm state
    --     changes to @ACKNOWLEDGED@.
    --
    -- -   @RESET@ - When you reset the alarm, the alarm state changes to
    --     @NORMAL@.
    --
    -- For more information, see the
    -- <https://docs.aws.amazon.com/iotevents/latest/apireference/API_iotevents-data_AlarmState.html AlarmState>
    -- API.
    CustomerAction -> Maybe CustomerActionName
actionName :: Prelude.Maybe CustomerActionName,
    -- | Contains the configuration information of a disable action.
    CustomerAction -> Maybe DisableActionConfiguration
disableActionConfiguration :: Prelude.Maybe DisableActionConfiguration,
    -- | Contains the configuration information of an enable action.
    CustomerAction -> Maybe EnableActionConfiguration
enableActionConfiguration :: Prelude.Maybe EnableActionConfiguration,
    -- | Contains the configuration information of a reset action.
    CustomerAction -> Maybe ResetActionConfiguration
resetActionConfiguration :: Prelude.Maybe ResetActionConfiguration,
    -- | Contains the configuration information of a snooze action.
    CustomerAction -> Maybe SnoozeActionConfiguration
snoozeActionConfiguration :: Prelude.Maybe SnoozeActionConfiguration
  }
  deriving (CustomerAction -> CustomerAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomerAction -> CustomerAction -> Bool
$c/= :: CustomerAction -> CustomerAction -> Bool
== :: CustomerAction -> CustomerAction -> Bool
$c== :: CustomerAction -> CustomerAction -> Bool
Prelude.Eq, ReadPrec [CustomerAction]
ReadPrec CustomerAction
Int -> ReadS CustomerAction
ReadS [CustomerAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomerAction]
$creadListPrec :: ReadPrec [CustomerAction]
readPrec :: ReadPrec CustomerAction
$creadPrec :: ReadPrec CustomerAction
readList :: ReadS [CustomerAction]
$creadList :: ReadS [CustomerAction]
readsPrec :: Int -> ReadS CustomerAction
$creadsPrec :: Int -> ReadS CustomerAction
Prelude.Read, Int -> CustomerAction -> ShowS
[CustomerAction] -> ShowS
CustomerAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomerAction] -> ShowS
$cshowList :: [CustomerAction] -> ShowS
show :: CustomerAction -> String
$cshow :: CustomerAction -> String
showsPrec :: Int -> CustomerAction -> ShowS
$cshowsPrec :: Int -> CustomerAction -> ShowS
Prelude.Show, forall x. Rep CustomerAction x -> CustomerAction
forall x. CustomerAction -> Rep CustomerAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomerAction x -> CustomerAction
$cfrom :: forall x. CustomerAction -> Rep CustomerAction x
Prelude.Generic)

-- |
-- Create a value of 'CustomerAction' 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:
--
-- 'acknowledgeActionConfiguration', 'customerAction_acknowledgeActionConfiguration' - Contains the configuration information of an acknowledge action.
--
-- 'actionName', 'customerAction_actionName' - The name of the action. The action name can be one of the following
-- values:
--
-- -   @SNOOZE@ - When you snooze the alarm, the alarm state changes to
--     @SNOOZE_DISABLED@.
--
-- -   @ENABLE@ - When you enable the alarm, the alarm state changes to
--     @NORMAL@.
--
-- -   @DISABLE@ - When you disable the alarm, the alarm state changes to
--     @DISABLED@.
--
-- -   @ACKNOWLEDGE@ - When you acknowledge the alarm, the alarm state
--     changes to @ACKNOWLEDGED@.
--
-- -   @RESET@ - When you reset the alarm, the alarm state changes to
--     @NORMAL@.
--
-- For more information, see the
-- <https://docs.aws.amazon.com/iotevents/latest/apireference/API_iotevents-data_AlarmState.html AlarmState>
-- API.
--
-- 'disableActionConfiguration', 'customerAction_disableActionConfiguration' - Contains the configuration information of a disable action.
--
-- 'enableActionConfiguration', 'customerAction_enableActionConfiguration' - Contains the configuration information of an enable action.
--
-- 'resetActionConfiguration', 'customerAction_resetActionConfiguration' - Contains the configuration information of a reset action.
--
-- 'snoozeActionConfiguration', 'customerAction_snoozeActionConfiguration' - Contains the configuration information of a snooze action.
newCustomerAction ::
  CustomerAction
newCustomerAction :: CustomerAction
newCustomerAction =
  CustomerAction'
    { $sel:acknowledgeActionConfiguration:CustomerAction' :: Maybe AcknowledgeActionConfiguration
acknowledgeActionConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:actionName:CustomerAction' :: Maybe CustomerActionName
actionName = forall a. Maybe a
Prelude.Nothing,
      $sel:disableActionConfiguration:CustomerAction' :: Maybe DisableActionConfiguration
disableActionConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:enableActionConfiguration:CustomerAction' :: Maybe EnableActionConfiguration
enableActionConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:resetActionConfiguration:CustomerAction' :: Maybe ResetActionConfiguration
resetActionConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:snoozeActionConfiguration:CustomerAction' :: Maybe SnoozeActionConfiguration
snoozeActionConfiguration = forall a. Maybe a
Prelude.Nothing
    }

-- | Contains the configuration information of an acknowledge action.
customerAction_acknowledgeActionConfiguration :: Lens.Lens' CustomerAction (Prelude.Maybe AcknowledgeActionConfiguration)
customerAction_acknowledgeActionConfiguration :: Lens' CustomerAction (Maybe AcknowledgeActionConfiguration)
customerAction_acknowledgeActionConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerAction' {Maybe AcknowledgeActionConfiguration
acknowledgeActionConfiguration :: Maybe AcknowledgeActionConfiguration
$sel:acknowledgeActionConfiguration:CustomerAction' :: CustomerAction -> Maybe AcknowledgeActionConfiguration
acknowledgeActionConfiguration} -> Maybe AcknowledgeActionConfiguration
acknowledgeActionConfiguration) (\s :: CustomerAction
s@CustomerAction' {} Maybe AcknowledgeActionConfiguration
a -> CustomerAction
s {$sel:acknowledgeActionConfiguration:CustomerAction' :: Maybe AcknowledgeActionConfiguration
acknowledgeActionConfiguration = Maybe AcknowledgeActionConfiguration
a} :: CustomerAction)

-- | The name of the action. The action name can be one of the following
-- values:
--
-- -   @SNOOZE@ - When you snooze the alarm, the alarm state changes to
--     @SNOOZE_DISABLED@.
--
-- -   @ENABLE@ - When you enable the alarm, the alarm state changes to
--     @NORMAL@.
--
-- -   @DISABLE@ - When you disable the alarm, the alarm state changes to
--     @DISABLED@.
--
-- -   @ACKNOWLEDGE@ - When you acknowledge the alarm, the alarm state
--     changes to @ACKNOWLEDGED@.
--
-- -   @RESET@ - When you reset the alarm, the alarm state changes to
--     @NORMAL@.
--
-- For more information, see the
-- <https://docs.aws.amazon.com/iotevents/latest/apireference/API_iotevents-data_AlarmState.html AlarmState>
-- API.
customerAction_actionName :: Lens.Lens' CustomerAction (Prelude.Maybe CustomerActionName)
customerAction_actionName :: Lens' CustomerAction (Maybe CustomerActionName)
customerAction_actionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerAction' {Maybe CustomerActionName
actionName :: Maybe CustomerActionName
$sel:actionName:CustomerAction' :: CustomerAction -> Maybe CustomerActionName
actionName} -> Maybe CustomerActionName
actionName) (\s :: CustomerAction
s@CustomerAction' {} Maybe CustomerActionName
a -> CustomerAction
s {$sel:actionName:CustomerAction' :: Maybe CustomerActionName
actionName = Maybe CustomerActionName
a} :: CustomerAction)

-- | Contains the configuration information of a disable action.
customerAction_disableActionConfiguration :: Lens.Lens' CustomerAction (Prelude.Maybe DisableActionConfiguration)
customerAction_disableActionConfiguration :: Lens' CustomerAction (Maybe DisableActionConfiguration)
customerAction_disableActionConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerAction' {Maybe DisableActionConfiguration
disableActionConfiguration :: Maybe DisableActionConfiguration
$sel:disableActionConfiguration:CustomerAction' :: CustomerAction -> Maybe DisableActionConfiguration
disableActionConfiguration} -> Maybe DisableActionConfiguration
disableActionConfiguration) (\s :: CustomerAction
s@CustomerAction' {} Maybe DisableActionConfiguration
a -> CustomerAction
s {$sel:disableActionConfiguration:CustomerAction' :: Maybe DisableActionConfiguration
disableActionConfiguration = Maybe DisableActionConfiguration
a} :: CustomerAction)

-- | Contains the configuration information of an enable action.
customerAction_enableActionConfiguration :: Lens.Lens' CustomerAction (Prelude.Maybe EnableActionConfiguration)
customerAction_enableActionConfiguration :: Lens' CustomerAction (Maybe EnableActionConfiguration)
customerAction_enableActionConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerAction' {Maybe EnableActionConfiguration
enableActionConfiguration :: Maybe EnableActionConfiguration
$sel:enableActionConfiguration:CustomerAction' :: CustomerAction -> Maybe EnableActionConfiguration
enableActionConfiguration} -> Maybe EnableActionConfiguration
enableActionConfiguration) (\s :: CustomerAction
s@CustomerAction' {} Maybe EnableActionConfiguration
a -> CustomerAction
s {$sel:enableActionConfiguration:CustomerAction' :: Maybe EnableActionConfiguration
enableActionConfiguration = Maybe EnableActionConfiguration
a} :: CustomerAction)

-- | Contains the configuration information of a reset action.
customerAction_resetActionConfiguration :: Lens.Lens' CustomerAction (Prelude.Maybe ResetActionConfiguration)
customerAction_resetActionConfiguration :: Lens' CustomerAction (Maybe ResetActionConfiguration)
customerAction_resetActionConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerAction' {Maybe ResetActionConfiguration
resetActionConfiguration :: Maybe ResetActionConfiguration
$sel:resetActionConfiguration:CustomerAction' :: CustomerAction -> Maybe ResetActionConfiguration
resetActionConfiguration} -> Maybe ResetActionConfiguration
resetActionConfiguration) (\s :: CustomerAction
s@CustomerAction' {} Maybe ResetActionConfiguration
a -> CustomerAction
s {$sel:resetActionConfiguration:CustomerAction' :: Maybe ResetActionConfiguration
resetActionConfiguration = Maybe ResetActionConfiguration
a} :: CustomerAction)

-- | Contains the configuration information of a snooze action.
customerAction_snoozeActionConfiguration :: Lens.Lens' CustomerAction (Prelude.Maybe SnoozeActionConfiguration)
customerAction_snoozeActionConfiguration :: Lens' CustomerAction (Maybe SnoozeActionConfiguration)
customerAction_snoozeActionConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerAction' {Maybe SnoozeActionConfiguration
snoozeActionConfiguration :: Maybe SnoozeActionConfiguration
$sel:snoozeActionConfiguration:CustomerAction' :: CustomerAction -> Maybe SnoozeActionConfiguration
snoozeActionConfiguration} -> Maybe SnoozeActionConfiguration
snoozeActionConfiguration) (\s :: CustomerAction
s@CustomerAction' {} Maybe SnoozeActionConfiguration
a -> CustomerAction
s {$sel:snoozeActionConfiguration:CustomerAction' :: Maybe SnoozeActionConfiguration
snoozeActionConfiguration = Maybe SnoozeActionConfiguration
a} :: CustomerAction)

instance Data.FromJSON CustomerAction where
  parseJSON :: Value -> Parser CustomerAction
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomerAction"
      ( \Object
x ->
          Maybe AcknowledgeActionConfiguration
-> Maybe CustomerActionName
-> Maybe DisableActionConfiguration
-> Maybe EnableActionConfiguration
-> Maybe ResetActionConfiguration
-> Maybe SnoozeActionConfiguration
-> CustomerAction
CustomerAction'
            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
"acknowledgeActionConfiguration")
            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
"actionName")
            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
"disableActionConfiguration")
            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
"enableActionConfiguration")
            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
"resetActionConfiguration")
            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
"snoozeActionConfiguration")
      )

instance Prelude.Hashable CustomerAction where
  hashWithSalt :: Int -> CustomerAction -> Int
hashWithSalt Int
_salt CustomerAction' {Maybe AcknowledgeActionConfiguration
Maybe CustomerActionName
Maybe DisableActionConfiguration
Maybe EnableActionConfiguration
Maybe ResetActionConfiguration
Maybe SnoozeActionConfiguration
snoozeActionConfiguration :: Maybe SnoozeActionConfiguration
resetActionConfiguration :: Maybe ResetActionConfiguration
enableActionConfiguration :: Maybe EnableActionConfiguration
disableActionConfiguration :: Maybe DisableActionConfiguration
actionName :: Maybe CustomerActionName
acknowledgeActionConfiguration :: Maybe AcknowledgeActionConfiguration
$sel:snoozeActionConfiguration:CustomerAction' :: CustomerAction -> Maybe SnoozeActionConfiguration
$sel:resetActionConfiguration:CustomerAction' :: CustomerAction -> Maybe ResetActionConfiguration
$sel:enableActionConfiguration:CustomerAction' :: CustomerAction -> Maybe EnableActionConfiguration
$sel:disableActionConfiguration:CustomerAction' :: CustomerAction -> Maybe DisableActionConfiguration
$sel:actionName:CustomerAction' :: CustomerAction -> Maybe CustomerActionName
$sel:acknowledgeActionConfiguration:CustomerAction' :: CustomerAction -> Maybe AcknowledgeActionConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AcknowledgeActionConfiguration
acknowledgeActionConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomerActionName
actionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DisableActionConfiguration
disableActionConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EnableActionConfiguration
enableActionConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResetActionConfiguration
resetActionConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SnoozeActionConfiguration
snoozeActionConfiguration

instance Prelude.NFData CustomerAction where
  rnf :: CustomerAction -> ()
rnf CustomerAction' {Maybe AcknowledgeActionConfiguration
Maybe CustomerActionName
Maybe DisableActionConfiguration
Maybe EnableActionConfiguration
Maybe ResetActionConfiguration
Maybe SnoozeActionConfiguration
snoozeActionConfiguration :: Maybe SnoozeActionConfiguration
resetActionConfiguration :: Maybe ResetActionConfiguration
enableActionConfiguration :: Maybe EnableActionConfiguration
disableActionConfiguration :: Maybe DisableActionConfiguration
actionName :: Maybe CustomerActionName
acknowledgeActionConfiguration :: Maybe AcknowledgeActionConfiguration
$sel:snoozeActionConfiguration:CustomerAction' :: CustomerAction -> Maybe SnoozeActionConfiguration
$sel:resetActionConfiguration:CustomerAction' :: CustomerAction -> Maybe ResetActionConfiguration
$sel:enableActionConfiguration:CustomerAction' :: CustomerAction -> Maybe EnableActionConfiguration
$sel:disableActionConfiguration:CustomerAction' :: CustomerAction -> Maybe DisableActionConfiguration
$sel:actionName:CustomerAction' :: CustomerAction -> Maybe CustomerActionName
$sel:acknowledgeActionConfiguration:CustomerAction' :: CustomerAction -> Maybe AcknowledgeActionConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AcknowledgeActionConfiguration
acknowledgeActionConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomerActionName
actionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DisableActionConfiguration
disableActionConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EnableActionConfiguration
enableActionConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResetActionConfiguration
resetActionConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SnoozeActionConfiguration
snoozeActionConfiguration