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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the default alarm state. The configuration applies to all
-- alarms that were created based on this alarm model.
--
-- /See:/ 'newInitializationConfiguration' smart constructor.
data InitializationConfiguration = InitializationConfiguration'
  { -- | The value must be @TRUE@ or @FALSE@. If @FALSE@, all alarm instances
    -- created based on the alarm model are activated. The default value is
    -- @TRUE@.
    InitializationConfiguration -> Bool
disabledOnInitialization :: Prelude.Bool
  }
  deriving (InitializationConfiguration -> InitializationConfiguration -> Bool
(InitializationConfiguration
 -> InitializationConfiguration -> Bool)
-> (InitializationConfiguration
    -> InitializationConfiguration -> Bool)
-> Eq InitializationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InitializationConfiguration -> InitializationConfiguration -> Bool
$c/= :: InitializationConfiguration -> InitializationConfiguration -> Bool
== :: InitializationConfiguration -> InitializationConfiguration -> Bool
$c== :: InitializationConfiguration -> InitializationConfiguration -> Bool
Prelude.Eq, ReadPrec [InitializationConfiguration]
ReadPrec InitializationConfiguration
Int -> ReadS InitializationConfiguration
ReadS [InitializationConfiguration]
(Int -> ReadS InitializationConfiguration)
-> ReadS [InitializationConfiguration]
-> ReadPrec InitializationConfiguration
-> ReadPrec [InitializationConfiguration]
-> Read InitializationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InitializationConfiguration]
$creadListPrec :: ReadPrec [InitializationConfiguration]
readPrec :: ReadPrec InitializationConfiguration
$creadPrec :: ReadPrec InitializationConfiguration
readList :: ReadS [InitializationConfiguration]
$creadList :: ReadS [InitializationConfiguration]
readsPrec :: Int -> ReadS InitializationConfiguration
$creadsPrec :: Int -> ReadS InitializationConfiguration
Prelude.Read, Int -> InitializationConfiguration -> ShowS
[InitializationConfiguration] -> ShowS
InitializationConfiguration -> String
(Int -> InitializationConfiguration -> ShowS)
-> (InitializationConfiguration -> String)
-> ([InitializationConfiguration] -> ShowS)
-> Show InitializationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InitializationConfiguration] -> ShowS
$cshowList :: [InitializationConfiguration] -> ShowS
show :: InitializationConfiguration -> String
$cshow :: InitializationConfiguration -> String
showsPrec :: Int -> InitializationConfiguration -> ShowS
$cshowsPrec :: Int -> InitializationConfiguration -> ShowS
Prelude.Show, (forall x.
 InitializationConfiguration -> Rep InitializationConfiguration x)
-> (forall x.
    Rep InitializationConfiguration x -> InitializationConfiguration)
-> Generic InitializationConfiguration
forall x.
Rep InitializationConfiguration x -> InitializationConfiguration
forall x.
InitializationConfiguration -> Rep InitializationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InitializationConfiguration x -> InitializationConfiguration
$cfrom :: forall x.
InitializationConfiguration -> Rep InitializationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'InitializationConfiguration' 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:
--
-- 'disabledOnInitialization', 'initializationConfiguration_disabledOnInitialization' - The value must be @TRUE@ or @FALSE@. If @FALSE@, all alarm instances
-- created based on the alarm model are activated. The default value is
-- @TRUE@.
newInitializationConfiguration ::
  -- | 'disabledOnInitialization'
  Prelude.Bool ->
  InitializationConfiguration
newInitializationConfiguration :: Bool -> InitializationConfiguration
newInitializationConfiguration
  Bool
pDisabledOnInitialization_ =
    InitializationConfiguration' :: Bool -> InitializationConfiguration
InitializationConfiguration'
      { $sel:disabledOnInitialization:InitializationConfiguration' :: Bool
disabledOnInitialization =
          Bool
pDisabledOnInitialization_
      }

-- | The value must be @TRUE@ or @FALSE@. If @FALSE@, all alarm instances
-- created based on the alarm model are activated. The default value is
-- @TRUE@.
initializationConfiguration_disabledOnInitialization :: Lens.Lens' InitializationConfiguration Prelude.Bool
initializationConfiguration_disabledOnInitialization :: (Bool -> f Bool)
-> InitializationConfiguration -> f InitializationConfiguration
initializationConfiguration_disabledOnInitialization = (InitializationConfiguration -> Bool)
-> (InitializationConfiguration
    -> Bool -> InitializationConfiguration)
-> Lens
     InitializationConfiguration InitializationConfiguration Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitializationConfiguration' {Bool
disabledOnInitialization :: Bool
$sel:disabledOnInitialization:InitializationConfiguration' :: InitializationConfiguration -> Bool
disabledOnInitialization} -> Bool
disabledOnInitialization) (\s :: InitializationConfiguration
s@InitializationConfiguration' {} Bool
a -> InitializationConfiguration
s {$sel:disabledOnInitialization:InitializationConfiguration' :: Bool
disabledOnInitialization = Bool
a} :: InitializationConfiguration)

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

instance Prelude.Hashable InitializationConfiguration

instance Prelude.NFData InitializationConfiguration

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