{-# 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.StateChangeConfiguration
-- 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.StateChangeConfiguration 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.TriggerType
import qualified Amazonka.Prelude as Prelude

-- | Contains the configuration information of alarm state changes.
--
-- /See:/ 'newStateChangeConfiguration' smart constructor.
data StateChangeConfiguration = StateChangeConfiguration'
  { -- | The trigger type. If the value is @SNOOZE_TIMEOUT@, the snooze duration
    -- ends and the alarm automatically changes to the @NORMAL@ state.
    StateChangeConfiguration -> Maybe TriggerType
triggerType :: Prelude.Maybe TriggerType
  }
  deriving (StateChangeConfiguration -> StateChangeConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StateChangeConfiguration -> StateChangeConfiguration -> Bool
$c/= :: StateChangeConfiguration -> StateChangeConfiguration -> Bool
== :: StateChangeConfiguration -> StateChangeConfiguration -> Bool
$c== :: StateChangeConfiguration -> StateChangeConfiguration -> Bool
Prelude.Eq, ReadPrec [StateChangeConfiguration]
ReadPrec StateChangeConfiguration
Int -> ReadS StateChangeConfiguration
ReadS [StateChangeConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StateChangeConfiguration]
$creadListPrec :: ReadPrec [StateChangeConfiguration]
readPrec :: ReadPrec StateChangeConfiguration
$creadPrec :: ReadPrec StateChangeConfiguration
readList :: ReadS [StateChangeConfiguration]
$creadList :: ReadS [StateChangeConfiguration]
readsPrec :: Int -> ReadS StateChangeConfiguration
$creadsPrec :: Int -> ReadS StateChangeConfiguration
Prelude.Read, Int -> StateChangeConfiguration -> ShowS
[StateChangeConfiguration] -> ShowS
StateChangeConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StateChangeConfiguration] -> ShowS
$cshowList :: [StateChangeConfiguration] -> ShowS
show :: StateChangeConfiguration -> String
$cshow :: StateChangeConfiguration -> String
showsPrec :: Int -> StateChangeConfiguration -> ShowS
$cshowsPrec :: Int -> StateChangeConfiguration -> ShowS
Prelude.Show, forall x.
Rep StateChangeConfiguration x -> StateChangeConfiguration
forall x.
StateChangeConfiguration -> Rep StateChangeConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StateChangeConfiguration x -> StateChangeConfiguration
$cfrom :: forall x.
StateChangeConfiguration -> Rep StateChangeConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'StateChangeConfiguration' 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:
--
-- 'triggerType', 'stateChangeConfiguration_triggerType' - The trigger type. If the value is @SNOOZE_TIMEOUT@, the snooze duration
-- ends and the alarm automatically changes to the @NORMAL@ state.
newStateChangeConfiguration ::
  StateChangeConfiguration
newStateChangeConfiguration :: StateChangeConfiguration
newStateChangeConfiguration =
  StateChangeConfiguration'
    { $sel:triggerType:StateChangeConfiguration' :: Maybe TriggerType
triggerType =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The trigger type. If the value is @SNOOZE_TIMEOUT@, the snooze duration
-- ends and the alarm automatically changes to the @NORMAL@ state.
stateChangeConfiguration_triggerType :: Lens.Lens' StateChangeConfiguration (Prelude.Maybe TriggerType)
stateChangeConfiguration_triggerType :: Lens' StateChangeConfiguration (Maybe TriggerType)
stateChangeConfiguration_triggerType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StateChangeConfiguration' {Maybe TriggerType
triggerType :: Maybe TriggerType
$sel:triggerType:StateChangeConfiguration' :: StateChangeConfiguration -> Maybe TriggerType
triggerType} -> Maybe TriggerType
triggerType) (\s :: StateChangeConfiguration
s@StateChangeConfiguration' {} Maybe TriggerType
a -> StateChangeConfiguration
s {$sel:triggerType:StateChangeConfiguration' :: Maybe TriggerType
triggerType = Maybe TriggerType
a} :: StateChangeConfiguration)

instance Data.FromJSON StateChangeConfiguration where
  parseJSON :: Value -> Parser StateChangeConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StateChangeConfiguration"
      ( \Object
x ->
          Maybe TriggerType -> StateChangeConfiguration
StateChangeConfiguration'
            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
"triggerType")
      )

instance Prelude.Hashable StateChangeConfiguration where
  hashWithSalt :: Int -> StateChangeConfiguration -> Int
hashWithSalt Int
_salt StateChangeConfiguration' {Maybe TriggerType
triggerType :: Maybe TriggerType
$sel:triggerType:StateChangeConfiguration' :: StateChangeConfiguration -> Maybe TriggerType
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TriggerType
triggerType

instance Prelude.NFData StateChangeConfiguration where
  rnf :: StateChangeConfiguration -> ()
rnf StateChangeConfiguration' {Maybe TriggerType
triggerType :: Maybe TriggerType
$sel:triggerType:StateChangeConfiguration' :: StateChangeConfiguration -> Maybe TriggerType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TriggerType
triggerType