{-# 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.DetectorDebugOption
-- 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.DetectorDebugOption 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

-- | The detector model and the specific detectors (instances) for which the
-- logging level is given.
--
-- /See:/ 'newDetectorDebugOption' smart constructor.
data DetectorDebugOption = DetectorDebugOption'
  { -- | The value of the input attribute key used to create the detector (the
    -- instance of the detector model).
    DetectorDebugOption -> Maybe Text
keyValue :: Prelude.Maybe Prelude.Text,
    -- | The name of the detector model.
    DetectorDebugOption -> Text
detectorModelName :: Prelude.Text
  }
  deriving (DetectorDebugOption -> DetectorDebugOption -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectorDebugOption -> DetectorDebugOption -> Bool
$c/= :: DetectorDebugOption -> DetectorDebugOption -> Bool
== :: DetectorDebugOption -> DetectorDebugOption -> Bool
$c== :: DetectorDebugOption -> DetectorDebugOption -> Bool
Prelude.Eq, ReadPrec [DetectorDebugOption]
ReadPrec DetectorDebugOption
Int -> ReadS DetectorDebugOption
ReadS [DetectorDebugOption]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectorDebugOption]
$creadListPrec :: ReadPrec [DetectorDebugOption]
readPrec :: ReadPrec DetectorDebugOption
$creadPrec :: ReadPrec DetectorDebugOption
readList :: ReadS [DetectorDebugOption]
$creadList :: ReadS [DetectorDebugOption]
readsPrec :: Int -> ReadS DetectorDebugOption
$creadsPrec :: Int -> ReadS DetectorDebugOption
Prelude.Read, Int -> DetectorDebugOption -> ShowS
[DetectorDebugOption] -> ShowS
DetectorDebugOption -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectorDebugOption] -> ShowS
$cshowList :: [DetectorDebugOption] -> ShowS
show :: DetectorDebugOption -> String
$cshow :: DetectorDebugOption -> String
showsPrec :: Int -> DetectorDebugOption -> ShowS
$cshowsPrec :: Int -> DetectorDebugOption -> ShowS
Prelude.Show, forall x. Rep DetectorDebugOption x -> DetectorDebugOption
forall x. DetectorDebugOption -> Rep DetectorDebugOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectorDebugOption x -> DetectorDebugOption
$cfrom :: forall x. DetectorDebugOption -> Rep DetectorDebugOption x
Prelude.Generic)

-- |
-- Create a value of 'DetectorDebugOption' 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:
--
-- 'keyValue', 'detectorDebugOption_keyValue' - The value of the input attribute key used to create the detector (the
-- instance of the detector model).
--
-- 'detectorModelName', 'detectorDebugOption_detectorModelName' - The name of the detector model.
newDetectorDebugOption ::
  -- | 'detectorModelName'
  Prelude.Text ->
  DetectorDebugOption
newDetectorDebugOption :: Text -> DetectorDebugOption
newDetectorDebugOption Text
pDetectorModelName_ =
  DetectorDebugOption'
    { $sel:keyValue:DetectorDebugOption' :: Maybe Text
keyValue = forall a. Maybe a
Prelude.Nothing,
      $sel:detectorModelName:DetectorDebugOption' :: Text
detectorModelName = Text
pDetectorModelName_
    }

-- | The value of the input attribute key used to create the detector (the
-- instance of the detector model).
detectorDebugOption_keyValue :: Lens.Lens' DetectorDebugOption (Prelude.Maybe Prelude.Text)
detectorDebugOption_keyValue :: Lens' DetectorDebugOption (Maybe Text)
detectorDebugOption_keyValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectorDebugOption' {Maybe Text
keyValue :: Maybe Text
$sel:keyValue:DetectorDebugOption' :: DetectorDebugOption -> Maybe Text
keyValue} -> Maybe Text
keyValue) (\s :: DetectorDebugOption
s@DetectorDebugOption' {} Maybe Text
a -> DetectorDebugOption
s {$sel:keyValue:DetectorDebugOption' :: Maybe Text
keyValue = Maybe Text
a} :: DetectorDebugOption)

-- | The name of the detector model.
detectorDebugOption_detectorModelName :: Lens.Lens' DetectorDebugOption Prelude.Text
detectorDebugOption_detectorModelName :: Lens' DetectorDebugOption Text
detectorDebugOption_detectorModelName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectorDebugOption' {Text
detectorModelName :: Text
$sel:detectorModelName:DetectorDebugOption' :: DetectorDebugOption -> Text
detectorModelName} -> Text
detectorModelName) (\s :: DetectorDebugOption
s@DetectorDebugOption' {} Text
a -> DetectorDebugOption
s {$sel:detectorModelName:DetectorDebugOption' :: Text
detectorModelName = Text
a} :: DetectorDebugOption)

instance Data.FromJSON DetectorDebugOption where
  parseJSON :: Value -> Parser DetectorDebugOption
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DetectorDebugOption"
      ( \Object
x ->
          Maybe Text -> Text -> DetectorDebugOption
DetectorDebugOption'
            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
"keyValue")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"detectorModelName")
      )

instance Prelude.Hashable DetectorDebugOption where
  hashWithSalt :: Int -> DetectorDebugOption -> Int
hashWithSalt Int
_salt DetectorDebugOption' {Maybe Text
Text
detectorModelName :: Text
keyValue :: Maybe Text
$sel:detectorModelName:DetectorDebugOption' :: DetectorDebugOption -> Text
$sel:keyValue:DetectorDebugOption' :: DetectorDebugOption -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
keyValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
detectorModelName

instance Prelude.NFData DetectorDebugOption where
  rnf :: DetectorDebugOption -> ()
rnf DetectorDebugOption' {Maybe Text
Text
detectorModelName :: Text
keyValue :: Maybe Text
$sel:detectorModelName:DetectorDebugOption' :: DetectorDebugOption -> Text
$sel:keyValue:DetectorDebugOption' :: DetectorDebugOption -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
keyValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
detectorModelName

instance Data.ToJSON DetectorDebugOption where
  toJSON :: DetectorDebugOption -> Value
toJSON DetectorDebugOption' {Maybe Text
Text
detectorModelName :: Text
keyValue :: Maybe Text
$sel:detectorModelName:DetectorDebugOption' :: DetectorDebugOption -> Text
$sel:keyValue:DetectorDebugOption' :: DetectorDebugOption -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"keyValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
keyValue,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"detectorModelName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
detectorModelName)
          ]
      )