{-# 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.DetectorStateSummary
-- 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.IoTEventsData.Types.DetectorStateSummary where

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

-- | Information about the detector state.
--
-- /See:/ 'newDetectorStateSummary' smart constructor.
data DetectorStateSummary = DetectorStateSummary'
  { -- | The name of the state.
    DetectorStateSummary -> Maybe Text
stateName :: Prelude.Maybe Prelude.Text
  }
  deriving (DetectorStateSummary -> DetectorStateSummary -> Bool
(DetectorStateSummary -> DetectorStateSummary -> Bool)
-> (DetectorStateSummary -> DetectorStateSummary -> Bool)
-> Eq DetectorStateSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectorStateSummary -> DetectorStateSummary -> Bool
$c/= :: DetectorStateSummary -> DetectorStateSummary -> Bool
== :: DetectorStateSummary -> DetectorStateSummary -> Bool
$c== :: DetectorStateSummary -> DetectorStateSummary -> Bool
Prelude.Eq, ReadPrec [DetectorStateSummary]
ReadPrec DetectorStateSummary
Int -> ReadS DetectorStateSummary
ReadS [DetectorStateSummary]
(Int -> ReadS DetectorStateSummary)
-> ReadS [DetectorStateSummary]
-> ReadPrec DetectorStateSummary
-> ReadPrec [DetectorStateSummary]
-> Read DetectorStateSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectorStateSummary]
$creadListPrec :: ReadPrec [DetectorStateSummary]
readPrec :: ReadPrec DetectorStateSummary
$creadPrec :: ReadPrec DetectorStateSummary
readList :: ReadS [DetectorStateSummary]
$creadList :: ReadS [DetectorStateSummary]
readsPrec :: Int -> ReadS DetectorStateSummary
$creadsPrec :: Int -> ReadS DetectorStateSummary
Prelude.Read, Int -> DetectorStateSummary -> ShowS
[DetectorStateSummary] -> ShowS
DetectorStateSummary -> String
(Int -> DetectorStateSummary -> ShowS)
-> (DetectorStateSummary -> String)
-> ([DetectorStateSummary] -> ShowS)
-> Show DetectorStateSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectorStateSummary] -> ShowS
$cshowList :: [DetectorStateSummary] -> ShowS
show :: DetectorStateSummary -> String
$cshow :: DetectorStateSummary -> String
showsPrec :: Int -> DetectorStateSummary -> ShowS
$cshowsPrec :: Int -> DetectorStateSummary -> ShowS
Prelude.Show, (forall x. DetectorStateSummary -> Rep DetectorStateSummary x)
-> (forall x. Rep DetectorStateSummary x -> DetectorStateSummary)
-> Generic DetectorStateSummary
forall x. Rep DetectorStateSummary x -> DetectorStateSummary
forall x. DetectorStateSummary -> Rep DetectorStateSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectorStateSummary x -> DetectorStateSummary
$cfrom :: forall x. DetectorStateSummary -> Rep DetectorStateSummary x
Prelude.Generic)

-- |
-- Create a value of 'DetectorStateSummary' 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:
--
-- 'stateName', 'detectorStateSummary_stateName' - The name of the state.
newDetectorStateSummary ::
  DetectorStateSummary
newDetectorStateSummary :: DetectorStateSummary
newDetectorStateSummary =
  DetectorStateSummary' :: Maybe Text -> DetectorStateSummary
DetectorStateSummary' {$sel:stateName:DetectorStateSummary' :: Maybe Text
stateName = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The name of the state.
detectorStateSummary_stateName :: Lens.Lens' DetectorStateSummary (Prelude.Maybe Prelude.Text)
detectorStateSummary_stateName :: (Maybe Text -> f (Maybe Text))
-> DetectorStateSummary -> f DetectorStateSummary
detectorStateSummary_stateName = (DetectorStateSummary -> Maybe Text)
-> (DetectorStateSummary -> Maybe Text -> DetectorStateSummary)
-> Lens
     DetectorStateSummary DetectorStateSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectorStateSummary' {Maybe Text
stateName :: Maybe Text
$sel:stateName:DetectorStateSummary' :: DetectorStateSummary -> Maybe Text
stateName} -> Maybe Text
stateName) (\s :: DetectorStateSummary
s@DetectorStateSummary' {} Maybe Text
a -> DetectorStateSummary
s {$sel:stateName:DetectorStateSummary' :: Maybe Text
stateName = Maybe Text
a} :: DetectorStateSummary)

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

instance Prelude.Hashable DetectorStateSummary

instance Prelude.NFData DetectorStateSummary