{-# 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.DetectorModel
-- 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.DetectorModel where

import qualified Amazonka.Core as Core
import Amazonka.IoTEvents.Types.DetectorModelConfiguration
import Amazonka.IoTEvents.Types.DetectorModelDefinition
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the detector model.
--
-- /See:/ 'newDetectorModel' smart constructor.
data DetectorModel = DetectorModel'
  { -- | Information about how the detector is configured.
    DetectorModel -> Maybe DetectorModelConfiguration
detectorModelConfiguration :: Prelude.Maybe DetectorModelConfiguration,
    -- | Information that defines how a detector operates.
    DetectorModel -> Maybe DetectorModelDefinition
detectorModelDefinition :: Prelude.Maybe DetectorModelDefinition
  }
  deriving (DetectorModel -> DetectorModel -> Bool
(DetectorModel -> DetectorModel -> Bool)
-> (DetectorModel -> DetectorModel -> Bool) -> Eq DetectorModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectorModel -> DetectorModel -> Bool
$c/= :: DetectorModel -> DetectorModel -> Bool
== :: DetectorModel -> DetectorModel -> Bool
$c== :: DetectorModel -> DetectorModel -> Bool
Prelude.Eq, ReadPrec [DetectorModel]
ReadPrec DetectorModel
Int -> ReadS DetectorModel
ReadS [DetectorModel]
(Int -> ReadS DetectorModel)
-> ReadS [DetectorModel]
-> ReadPrec DetectorModel
-> ReadPrec [DetectorModel]
-> Read DetectorModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectorModel]
$creadListPrec :: ReadPrec [DetectorModel]
readPrec :: ReadPrec DetectorModel
$creadPrec :: ReadPrec DetectorModel
readList :: ReadS [DetectorModel]
$creadList :: ReadS [DetectorModel]
readsPrec :: Int -> ReadS DetectorModel
$creadsPrec :: Int -> ReadS DetectorModel
Prelude.Read, Int -> DetectorModel -> ShowS
[DetectorModel] -> ShowS
DetectorModel -> String
(Int -> DetectorModel -> ShowS)
-> (DetectorModel -> String)
-> ([DetectorModel] -> ShowS)
-> Show DetectorModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectorModel] -> ShowS
$cshowList :: [DetectorModel] -> ShowS
show :: DetectorModel -> String
$cshow :: DetectorModel -> String
showsPrec :: Int -> DetectorModel -> ShowS
$cshowsPrec :: Int -> DetectorModel -> ShowS
Prelude.Show, (forall x. DetectorModel -> Rep DetectorModel x)
-> (forall x. Rep DetectorModel x -> DetectorModel)
-> Generic DetectorModel
forall x. Rep DetectorModel x -> DetectorModel
forall x. DetectorModel -> Rep DetectorModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectorModel x -> DetectorModel
$cfrom :: forall x. DetectorModel -> Rep DetectorModel x
Prelude.Generic)

-- |
-- Create a value of 'DetectorModel' 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:
--
-- 'detectorModelConfiguration', 'detectorModel_detectorModelConfiguration' - Information about how the detector is configured.
--
-- 'detectorModelDefinition', 'detectorModel_detectorModelDefinition' - Information that defines how a detector operates.
newDetectorModel ::
  DetectorModel
newDetectorModel :: DetectorModel
newDetectorModel =
  DetectorModel' :: Maybe DetectorModelConfiguration
-> Maybe DetectorModelDefinition -> DetectorModel
DetectorModel'
    { $sel:detectorModelConfiguration:DetectorModel' :: Maybe DetectorModelConfiguration
detectorModelConfiguration =
        Maybe DetectorModelConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:detectorModelDefinition:DetectorModel' :: Maybe DetectorModelDefinition
detectorModelDefinition = Maybe DetectorModelDefinition
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about how the detector is configured.
detectorModel_detectorModelConfiguration :: Lens.Lens' DetectorModel (Prelude.Maybe DetectorModelConfiguration)
detectorModel_detectorModelConfiguration :: (Maybe DetectorModelConfiguration
 -> f (Maybe DetectorModelConfiguration))
-> DetectorModel -> f DetectorModel
detectorModel_detectorModelConfiguration = (DetectorModel -> Maybe DetectorModelConfiguration)
-> (DetectorModel
    -> Maybe DetectorModelConfiguration -> DetectorModel)
-> Lens
     DetectorModel
     DetectorModel
     (Maybe DetectorModelConfiguration)
     (Maybe DetectorModelConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectorModel' {Maybe DetectorModelConfiguration
detectorModelConfiguration :: Maybe DetectorModelConfiguration
$sel:detectorModelConfiguration:DetectorModel' :: DetectorModel -> Maybe DetectorModelConfiguration
detectorModelConfiguration} -> Maybe DetectorModelConfiguration
detectorModelConfiguration) (\s :: DetectorModel
s@DetectorModel' {} Maybe DetectorModelConfiguration
a -> DetectorModel
s {$sel:detectorModelConfiguration:DetectorModel' :: Maybe DetectorModelConfiguration
detectorModelConfiguration = Maybe DetectorModelConfiguration
a} :: DetectorModel)

-- | Information that defines how a detector operates.
detectorModel_detectorModelDefinition :: Lens.Lens' DetectorModel (Prelude.Maybe DetectorModelDefinition)
detectorModel_detectorModelDefinition :: (Maybe DetectorModelDefinition
 -> f (Maybe DetectorModelDefinition))
-> DetectorModel -> f DetectorModel
detectorModel_detectorModelDefinition = (DetectorModel -> Maybe DetectorModelDefinition)
-> (DetectorModel
    -> Maybe DetectorModelDefinition -> DetectorModel)
-> Lens
     DetectorModel
     DetectorModel
     (Maybe DetectorModelDefinition)
     (Maybe DetectorModelDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectorModel' {Maybe DetectorModelDefinition
detectorModelDefinition :: Maybe DetectorModelDefinition
$sel:detectorModelDefinition:DetectorModel' :: DetectorModel -> Maybe DetectorModelDefinition
detectorModelDefinition} -> Maybe DetectorModelDefinition
detectorModelDefinition) (\s :: DetectorModel
s@DetectorModel' {} Maybe DetectorModelDefinition
a -> DetectorModel
s {$sel:detectorModelDefinition:DetectorModel' :: Maybe DetectorModelDefinition
detectorModelDefinition = Maybe DetectorModelDefinition
a} :: DetectorModel)

instance Core.FromJSON DetectorModel where
  parseJSON :: Value -> Parser DetectorModel
parseJSON =
    String
-> (Object -> Parser DetectorModel)
-> Value
-> Parser DetectorModel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DetectorModel"
      ( \Object
x ->
          Maybe DetectorModelConfiguration
-> Maybe DetectorModelDefinition -> DetectorModel
DetectorModel'
            (Maybe DetectorModelConfiguration
 -> Maybe DetectorModelDefinition -> DetectorModel)
-> Parser (Maybe DetectorModelConfiguration)
-> Parser (Maybe DetectorModelDefinition -> DetectorModel)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DetectorModelConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"detectorModelConfiguration")
            Parser (Maybe DetectorModelDefinition -> DetectorModel)
-> Parser (Maybe DetectorModelDefinition) -> Parser DetectorModel
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DetectorModelDefinition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"detectorModelDefinition")
      )

instance Prelude.Hashable DetectorModel

instance Prelude.NFData DetectorModel