{-# 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 #-}
module Amazonka.IoTEventsData.Types.DetectorState where
import qualified Amazonka.Core as Core
import Amazonka.IoTEventsData.Types.Timer
import Amazonka.IoTEventsData.Types.Variable
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DetectorState = DetectorState'
{
DetectorState -> Text
stateName :: Prelude.Text,
DetectorState -> [Variable]
variables :: [Variable],
DetectorState -> [Timer]
timers :: [Timer]
}
deriving (DetectorState -> DetectorState -> Bool
(DetectorState -> DetectorState -> Bool)
-> (DetectorState -> DetectorState -> Bool) -> Eq DetectorState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectorState -> DetectorState -> Bool
$c/= :: DetectorState -> DetectorState -> Bool
== :: DetectorState -> DetectorState -> Bool
$c== :: DetectorState -> DetectorState -> Bool
Prelude.Eq, ReadPrec [DetectorState]
ReadPrec DetectorState
Int -> ReadS DetectorState
ReadS [DetectorState]
(Int -> ReadS DetectorState)
-> ReadS [DetectorState]
-> ReadPrec DetectorState
-> ReadPrec [DetectorState]
-> Read DetectorState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectorState]
$creadListPrec :: ReadPrec [DetectorState]
readPrec :: ReadPrec DetectorState
$creadPrec :: ReadPrec DetectorState
readList :: ReadS [DetectorState]
$creadList :: ReadS [DetectorState]
readsPrec :: Int -> ReadS DetectorState
$creadsPrec :: Int -> ReadS DetectorState
Prelude.Read, Int -> DetectorState -> ShowS
[DetectorState] -> ShowS
DetectorState -> String
(Int -> DetectorState -> ShowS)
-> (DetectorState -> String)
-> ([DetectorState] -> ShowS)
-> Show DetectorState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectorState] -> ShowS
$cshowList :: [DetectorState] -> ShowS
show :: DetectorState -> String
$cshow :: DetectorState -> String
showsPrec :: Int -> DetectorState -> ShowS
$cshowsPrec :: Int -> DetectorState -> ShowS
Prelude.Show, (forall x. DetectorState -> Rep DetectorState x)
-> (forall x. Rep DetectorState x -> DetectorState)
-> Generic DetectorState
forall x. Rep DetectorState x -> DetectorState
forall x. DetectorState -> Rep DetectorState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectorState x -> DetectorState
$cfrom :: forall x. DetectorState -> Rep DetectorState x
Prelude.Generic)
newDetectorState ::
Prelude.Text ->
DetectorState
newDetectorState :: Text -> DetectorState
newDetectorState Text
pStateName_ =
DetectorState' :: Text -> [Variable] -> [Timer] -> DetectorState
DetectorState'
{ $sel:stateName:DetectorState' :: Text
stateName = Text
pStateName_,
$sel:variables:DetectorState' :: [Variable]
variables = [Variable]
forall a. Monoid a => a
Prelude.mempty,
$sel:timers:DetectorState' :: [Timer]
timers = [Timer]
forall a. Monoid a => a
Prelude.mempty
}
detectorState_stateName :: Lens.Lens' DetectorState Prelude.Text
detectorState_stateName :: (Text -> f Text) -> DetectorState -> f DetectorState
detectorState_stateName = (DetectorState -> Text)
-> (DetectorState -> Text -> DetectorState)
-> Lens DetectorState DetectorState Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectorState' {Text
stateName :: Text
$sel:stateName:DetectorState' :: DetectorState -> Text
stateName} -> Text
stateName) (\s :: DetectorState
s@DetectorState' {} Text
a -> DetectorState
s {$sel:stateName:DetectorState' :: Text
stateName = Text
a} :: DetectorState)
detectorState_variables :: Lens.Lens' DetectorState [Variable]
detectorState_variables :: ([Variable] -> f [Variable]) -> DetectorState -> f DetectorState
detectorState_variables = (DetectorState -> [Variable])
-> (DetectorState -> [Variable] -> DetectorState)
-> Lens DetectorState DetectorState [Variable] [Variable]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectorState' {[Variable]
variables :: [Variable]
$sel:variables:DetectorState' :: DetectorState -> [Variable]
variables} -> [Variable]
variables) (\s :: DetectorState
s@DetectorState' {} [Variable]
a -> DetectorState
s {$sel:variables:DetectorState' :: [Variable]
variables = [Variable]
a} :: DetectorState) (([Variable] -> f [Variable]) -> DetectorState -> f DetectorState)
-> (([Variable] -> f [Variable]) -> [Variable] -> f [Variable])
-> ([Variable] -> f [Variable])
-> DetectorState
-> f DetectorState
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Variable] -> f [Variable]) -> [Variable] -> f [Variable]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
detectorState_timers :: Lens.Lens' DetectorState [Timer]
detectorState_timers :: ([Timer] -> f [Timer]) -> DetectorState -> f DetectorState
detectorState_timers = (DetectorState -> [Timer])
-> (DetectorState -> [Timer] -> DetectorState)
-> Lens DetectorState DetectorState [Timer] [Timer]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectorState' {[Timer]
timers :: [Timer]
$sel:timers:DetectorState' :: DetectorState -> [Timer]
timers} -> [Timer]
timers) (\s :: DetectorState
s@DetectorState' {} [Timer]
a -> DetectorState
s {$sel:timers:DetectorState' :: [Timer]
timers = [Timer]
a} :: DetectorState) (([Timer] -> f [Timer]) -> DetectorState -> f DetectorState)
-> (([Timer] -> f [Timer]) -> [Timer] -> f [Timer])
-> ([Timer] -> f [Timer])
-> DetectorState
-> f DetectorState
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Timer] -> f [Timer]) -> [Timer] -> f [Timer]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON DetectorState where
parseJSON :: Value -> Parser DetectorState
parseJSON =
String
-> (Object -> Parser DetectorState)
-> Value
-> Parser DetectorState
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DetectorState"
( \Object
x ->
Text -> [Variable] -> [Timer] -> DetectorState
DetectorState'
(Text -> [Variable] -> [Timer] -> DetectorState)
-> Parser Text -> Parser ([Variable] -> [Timer] -> DetectorState)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"stateName")
Parser ([Variable] -> [Timer] -> DetectorState)
-> Parser [Variable] -> Parser ([Timer] -> DetectorState)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [Variable])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"variables" Parser (Maybe [Variable]) -> [Variable] -> Parser [Variable]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Variable]
forall a. Monoid a => a
Prelude.mempty)
Parser ([Timer] -> DetectorState)
-> Parser [Timer] -> Parser DetectorState
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [Timer])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timers" Parser (Maybe [Timer]) -> [Timer] -> Parser [Timer]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Timer]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable DetectorState
instance Prelude.NFData DetectorState