{-# 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.DetectorStateDefinition where
import qualified Amazonka.Core as Core
import Amazonka.IoTEventsData.Types.TimerDefinition
import Amazonka.IoTEventsData.Types.VariableDefinition
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DetectorStateDefinition = DetectorStateDefinition'
{
DetectorStateDefinition -> Text
stateName :: Prelude.Text,
DetectorStateDefinition -> [VariableDefinition]
variables :: [VariableDefinition],
DetectorStateDefinition -> [TimerDefinition]
timers :: [TimerDefinition]
}
deriving (DetectorStateDefinition -> DetectorStateDefinition -> Bool
(DetectorStateDefinition -> DetectorStateDefinition -> Bool)
-> (DetectorStateDefinition -> DetectorStateDefinition -> Bool)
-> Eq DetectorStateDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectorStateDefinition -> DetectorStateDefinition -> Bool
$c/= :: DetectorStateDefinition -> DetectorStateDefinition -> Bool
== :: DetectorStateDefinition -> DetectorStateDefinition -> Bool
$c== :: DetectorStateDefinition -> DetectorStateDefinition -> Bool
Prelude.Eq, ReadPrec [DetectorStateDefinition]
ReadPrec DetectorStateDefinition
Int -> ReadS DetectorStateDefinition
ReadS [DetectorStateDefinition]
(Int -> ReadS DetectorStateDefinition)
-> ReadS [DetectorStateDefinition]
-> ReadPrec DetectorStateDefinition
-> ReadPrec [DetectorStateDefinition]
-> Read DetectorStateDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectorStateDefinition]
$creadListPrec :: ReadPrec [DetectorStateDefinition]
readPrec :: ReadPrec DetectorStateDefinition
$creadPrec :: ReadPrec DetectorStateDefinition
readList :: ReadS [DetectorStateDefinition]
$creadList :: ReadS [DetectorStateDefinition]
readsPrec :: Int -> ReadS DetectorStateDefinition
$creadsPrec :: Int -> ReadS DetectorStateDefinition
Prelude.Read, Int -> DetectorStateDefinition -> ShowS
[DetectorStateDefinition] -> ShowS
DetectorStateDefinition -> String
(Int -> DetectorStateDefinition -> ShowS)
-> (DetectorStateDefinition -> String)
-> ([DetectorStateDefinition] -> ShowS)
-> Show DetectorStateDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectorStateDefinition] -> ShowS
$cshowList :: [DetectorStateDefinition] -> ShowS
show :: DetectorStateDefinition -> String
$cshow :: DetectorStateDefinition -> String
showsPrec :: Int -> DetectorStateDefinition -> ShowS
$cshowsPrec :: Int -> DetectorStateDefinition -> ShowS
Prelude.Show, (forall x.
DetectorStateDefinition -> Rep DetectorStateDefinition x)
-> (forall x.
Rep DetectorStateDefinition x -> DetectorStateDefinition)
-> Generic DetectorStateDefinition
forall x. Rep DetectorStateDefinition x -> DetectorStateDefinition
forall x. DetectorStateDefinition -> Rep DetectorStateDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectorStateDefinition x -> DetectorStateDefinition
$cfrom :: forall x. DetectorStateDefinition -> Rep DetectorStateDefinition x
Prelude.Generic)
newDetectorStateDefinition ::
Prelude.Text ->
DetectorStateDefinition
newDetectorStateDefinition :: Text -> DetectorStateDefinition
newDetectorStateDefinition Text
pStateName_ =
DetectorStateDefinition' :: Text
-> [VariableDefinition]
-> [TimerDefinition]
-> DetectorStateDefinition
DetectorStateDefinition'
{ $sel:stateName:DetectorStateDefinition' :: Text
stateName = Text
pStateName_,
$sel:variables:DetectorStateDefinition' :: [VariableDefinition]
variables = [VariableDefinition]
forall a. Monoid a => a
Prelude.mempty,
$sel:timers:DetectorStateDefinition' :: [TimerDefinition]
timers = [TimerDefinition]
forall a. Monoid a => a
Prelude.mempty
}
detectorStateDefinition_stateName :: Lens.Lens' DetectorStateDefinition Prelude.Text
detectorStateDefinition_stateName :: (Text -> f Text)
-> DetectorStateDefinition -> f DetectorStateDefinition
detectorStateDefinition_stateName = (DetectorStateDefinition -> Text)
-> (DetectorStateDefinition -> Text -> DetectorStateDefinition)
-> Lens DetectorStateDefinition DetectorStateDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectorStateDefinition' {Text
stateName :: Text
$sel:stateName:DetectorStateDefinition' :: DetectorStateDefinition -> Text
stateName} -> Text
stateName) (\s :: DetectorStateDefinition
s@DetectorStateDefinition' {} Text
a -> DetectorStateDefinition
s {$sel:stateName:DetectorStateDefinition' :: Text
stateName = Text
a} :: DetectorStateDefinition)
detectorStateDefinition_variables :: Lens.Lens' DetectorStateDefinition [VariableDefinition]
detectorStateDefinition_variables :: ([VariableDefinition] -> f [VariableDefinition])
-> DetectorStateDefinition -> f DetectorStateDefinition
detectorStateDefinition_variables = (DetectorStateDefinition -> [VariableDefinition])
-> (DetectorStateDefinition
-> [VariableDefinition] -> DetectorStateDefinition)
-> Lens
DetectorStateDefinition
DetectorStateDefinition
[VariableDefinition]
[VariableDefinition]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectorStateDefinition' {[VariableDefinition]
variables :: [VariableDefinition]
$sel:variables:DetectorStateDefinition' :: DetectorStateDefinition -> [VariableDefinition]
variables} -> [VariableDefinition]
variables) (\s :: DetectorStateDefinition
s@DetectorStateDefinition' {} [VariableDefinition]
a -> DetectorStateDefinition
s {$sel:variables:DetectorStateDefinition' :: [VariableDefinition]
variables = [VariableDefinition]
a} :: DetectorStateDefinition) (([VariableDefinition] -> f [VariableDefinition])
-> DetectorStateDefinition -> f DetectorStateDefinition)
-> (([VariableDefinition] -> f [VariableDefinition])
-> [VariableDefinition] -> f [VariableDefinition])
-> ([VariableDefinition] -> f [VariableDefinition])
-> DetectorStateDefinition
-> f DetectorStateDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([VariableDefinition] -> f [VariableDefinition])
-> [VariableDefinition] -> f [VariableDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
detectorStateDefinition_timers :: Lens.Lens' DetectorStateDefinition [TimerDefinition]
detectorStateDefinition_timers :: ([TimerDefinition] -> f [TimerDefinition])
-> DetectorStateDefinition -> f DetectorStateDefinition
detectorStateDefinition_timers = (DetectorStateDefinition -> [TimerDefinition])
-> (DetectorStateDefinition
-> [TimerDefinition] -> DetectorStateDefinition)
-> Lens
DetectorStateDefinition
DetectorStateDefinition
[TimerDefinition]
[TimerDefinition]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectorStateDefinition' {[TimerDefinition]
timers :: [TimerDefinition]
$sel:timers:DetectorStateDefinition' :: DetectorStateDefinition -> [TimerDefinition]
timers} -> [TimerDefinition]
timers) (\s :: DetectorStateDefinition
s@DetectorStateDefinition' {} [TimerDefinition]
a -> DetectorStateDefinition
s {$sel:timers:DetectorStateDefinition' :: [TimerDefinition]
timers = [TimerDefinition]
a} :: DetectorStateDefinition) (([TimerDefinition] -> f [TimerDefinition])
-> DetectorStateDefinition -> f DetectorStateDefinition)
-> (([TimerDefinition] -> f [TimerDefinition])
-> [TimerDefinition] -> f [TimerDefinition])
-> ([TimerDefinition] -> f [TimerDefinition])
-> DetectorStateDefinition
-> f DetectorStateDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TimerDefinition] -> f [TimerDefinition])
-> [TimerDefinition] -> f [TimerDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable DetectorStateDefinition
instance Prelude.NFData DetectorStateDefinition
instance Core.ToJSON DetectorStateDefinition where
toJSON :: DetectorStateDefinition -> Value
toJSON DetectorStateDefinition' {[TimerDefinition]
[VariableDefinition]
Text
timers :: [TimerDefinition]
variables :: [VariableDefinition]
stateName :: Text
$sel:timers:DetectorStateDefinition' :: DetectorStateDefinition -> [TimerDefinition]
$sel:variables:DetectorStateDefinition' :: DetectorStateDefinition -> [VariableDefinition]
$sel:stateName:DetectorStateDefinition' :: DetectorStateDefinition -> Text
..} =
[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
"stateName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stateName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"variables" Text -> [VariableDefinition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [VariableDefinition]
variables),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"timers" Text -> [TimerDefinition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [TimerDefinition]
timers)
]
)