{-# 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.IoTEvents.Types.AcknowledgeFlow
-- 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.IoTEvents.Types.AcknowledgeFlow where

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

-- | Specifies whether to get notified for alarm state changes.
--
-- /See:/ 'newAcknowledgeFlow' smart constructor.
data AcknowledgeFlow = AcknowledgeFlow'
  { -- | The value must be @TRUE@ or @FALSE@. If @TRUE@, you receive a
    -- notification when the alarm state changes. You must choose to
    -- acknowledge the notification before the alarm state can return to
    -- @NORMAL@. If @FALSE@, you won\'t receive notifications. The alarm
    -- automatically changes to the @NORMAL@ state when the input property
    -- value returns to the specified range.
    AcknowledgeFlow -> Bool
enabled :: Prelude.Bool
  }
  deriving (AcknowledgeFlow -> AcknowledgeFlow -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcknowledgeFlow -> AcknowledgeFlow -> Bool
$c/= :: AcknowledgeFlow -> AcknowledgeFlow -> Bool
== :: AcknowledgeFlow -> AcknowledgeFlow -> Bool
$c== :: AcknowledgeFlow -> AcknowledgeFlow -> Bool
Prelude.Eq, ReadPrec [AcknowledgeFlow]
ReadPrec AcknowledgeFlow
Int -> ReadS AcknowledgeFlow
ReadS [AcknowledgeFlow]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcknowledgeFlow]
$creadListPrec :: ReadPrec [AcknowledgeFlow]
readPrec :: ReadPrec AcknowledgeFlow
$creadPrec :: ReadPrec AcknowledgeFlow
readList :: ReadS [AcknowledgeFlow]
$creadList :: ReadS [AcknowledgeFlow]
readsPrec :: Int -> ReadS AcknowledgeFlow
$creadsPrec :: Int -> ReadS AcknowledgeFlow
Prelude.Read, Int -> AcknowledgeFlow -> ShowS
[AcknowledgeFlow] -> ShowS
AcknowledgeFlow -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcknowledgeFlow] -> ShowS
$cshowList :: [AcknowledgeFlow] -> ShowS
show :: AcknowledgeFlow -> String
$cshow :: AcknowledgeFlow -> String
showsPrec :: Int -> AcknowledgeFlow -> ShowS
$cshowsPrec :: Int -> AcknowledgeFlow -> ShowS
Prelude.Show, forall x. Rep AcknowledgeFlow x -> AcknowledgeFlow
forall x. AcknowledgeFlow -> Rep AcknowledgeFlow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcknowledgeFlow x -> AcknowledgeFlow
$cfrom :: forall x. AcknowledgeFlow -> Rep AcknowledgeFlow x
Prelude.Generic)

-- |
-- Create a value of 'AcknowledgeFlow' 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:
--
-- 'enabled', 'acknowledgeFlow_enabled' - The value must be @TRUE@ or @FALSE@. If @TRUE@, you receive a
-- notification when the alarm state changes. You must choose to
-- acknowledge the notification before the alarm state can return to
-- @NORMAL@. If @FALSE@, you won\'t receive notifications. The alarm
-- automatically changes to the @NORMAL@ state when the input property
-- value returns to the specified range.
newAcknowledgeFlow ::
  -- | 'enabled'
  Prelude.Bool ->
  AcknowledgeFlow
newAcknowledgeFlow :: Bool -> AcknowledgeFlow
newAcknowledgeFlow Bool
pEnabled_ =
  AcknowledgeFlow' {$sel:enabled:AcknowledgeFlow' :: Bool
enabled = Bool
pEnabled_}

-- | The value must be @TRUE@ or @FALSE@. If @TRUE@, you receive a
-- notification when the alarm state changes. You must choose to
-- acknowledge the notification before the alarm state can return to
-- @NORMAL@. If @FALSE@, you won\'t receive notifications. The alarm
-- automatically changes to the @NORMAL@ state when the input property
-- value returns to the specified range.
acknowledgeFlow_enabled :: Lens.Lens' AcknowledgeFlow Prelude.Bool
acknowledgeFlow_enabled :: Lens' AcknowledgeFlow Bool
acknowledgeFlow_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcknowledgeFlow' {Bool
enabled :: Bool
$sel:enabled:AcknowledgeFlow' :: AcknowledgeFlow -> Bool
enabled} -> Bool
enabled) (\s :: AcknowledgeFlow
s@AcknowledgeFlow' {} Bool
a -> AcknowledgeFlow
s {$sel:enabled:AcknowledgeFlow' :: Bool
enabled = Bool
a} :: AcknowledgeFlow)

instance Data.FromJSON AcknowledgeFlow where
  parseJSON :: Value -> Parser AcknowledgeFlow
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AcknowledgeFlow"
      ( \Object
x ->
          Bool -> AcknowledgeFlow
AcknowledgeFlow' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"enabled")
      )

instance Prelude.Hashable AcknowledgeFlow where
  hashWithSalt :: Int -> AcknowledgeFlow -> Int
hashWithSalt Int
_salt AcknowledgeFlow' {Bool
enabled :: Bool
$sel:enabled:AcknowledgeFlow' :: AcknowledgeFlow -> Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
enabled

instance Prelude.NFData AcknowledgeFlow where
  rnf :: AcknowledgeFlow -> ()
rnf AcknowledgeFlow' {Bool
enabled :: Bool
$sel:enabled:AcknowledgeFlow' :: AcknowledgeFlow -> Bool
..} = forall a. NFData a => a -> ()
Prelude.rnf Bool
enabled

instance Data.ToJSON AcknowledgeFlow where
  toJSON :: AcknowledgeFlow -> Value
toJSON AcknowledgeFlow' {Bool
enabled :: Bool
$sel:enabled:AcknowledgeFlow' :: AcknowledgeFlow -> Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"enabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
enabled)]
      )