module Stratosphere.IoTEvents.DetectorModel.OnEnterProperty (
        module Exports, OnEnterProperty(..), mkOnEnterProperty
    ) where
import qualified Data.Aeson as JSON
import qualified Stratosphere.Prelude as Prelude
import Stratosphere.Property
import {-# SOURCE #-} Stratosphere.IoTEvents.DetectorModel.EventProperty as Exports
import Stratosphere.ResourceProperties
data OnEnterProperty
  = -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-onenter.html>
    OnEnterProperty {OnEnterProperty -> ()
haddock_workaround_ :: (),
                     -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotevents-detectormodel-onenter.html#cfn-iotevents-detectormodel-onenter-events>
                     OnEnterProperty -> Maybe [EventProperty]
events :: (Prelude.Maybe [EventProperty])}
  deriving stock (OnEnterProperty -> OnEnterProperty -> Bool
(OnEnterProperty -> OnEnterProperty -> Bool)
-> (OnEnterProperty -> OnEnterProperty -> Bool)
-> Eq OnEnterProperty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OnEnterProperty -> OnEnterProperty -> Bool
== :: OnEnterProperty -> OnEnterProperty -> Bool
$c/= :: OnEnterProperty -> OnEnterProperty -> Bool
/= :: OnEnterProperty -> OnEnterProperty -> Bool
Prelude.Eq, Int -> OnEnterProperty -> ShowS
[OnEnterProperty] -> ShowS
OnEnterProperty -> String
(Int -> OnEnterProperty -> ShowS)
-> (OnEnterProperty -> String)
-> ([OnEnterProperty] -> ShowS)
-> Show OnEnterProperty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OnEnterProperty -> ShowS
showsPrec :: Int -> OnEnterProperty -> ShowS
$cshow :: OnEnterProperty -> String
show :: OnEnterProperty -> String
$cshowList :: [OnEnterProperty] -> ShowS
showList :: [OnEnterProperty] -> ShowS
Prelude.Show)
mkOnEnterProperty :: OnEnterProperty
mkOnEnterProperty :: OnEnterProperty
mkOnEnterProperty
  = OnEnterProperty
      {haddock_workaround_ :: ()
haddock_workaround_ = (), events :: Maybe [EventProperty]
events = Maybe [EventProperty]
forall a. Maybe a
Prelude.Nothing}
instance ToResourceProperties OnEnterProperty where
  toResourceProperties :: OnEnterProperty -> ResourceProperties
toResourceProperties OnEnterProperty {Maybe [EventProperty]
()
haddock_workaround_ :: OnEnterProperty -> ()
events :: OnEnterProperty -> Maybe [EventProperty]
haddock_workaround_ :: ()
events :: Maybe [EventProperty]
..}
    = ResourceProperties
        {awsType :: Text
awsType = Text
"AWS::IoTEvents::DetectorModel.OnEnter",
         supportsTags :: Bool
supportsTags = Bool
Prelude.False,
         properties :: Object
properties = [Item Object] -> Object
forall l. IsList l => [Item l] -> l
Prelude.fromList
                        ([Maybe (Key, Value)] -> [(Key, Value)]
forall a. [Maybe a] -> [a]
Prelude.catMaybes [Key -> [EventProperty] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Events" ([EventProperty] -> (Key, Value))
-> Maybe [EventProperty] -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EventProperty]
events])}
instance JSON.ToJSON OnEnterProperty where
  toJSON :: OnEnterProperty -> Value
toJSON OnEnterProperty {Maybe [EventProperty]
()
haddock_workaround_ :: OnEnterProperty -> ()
events :: OnEnterProperty -> Maybe [EventProperty]
haddock_workaround_ :: ()
events :: Maybe [EventProperty]
..}
    = [(Key, Value)] -> Value
JSON.object
        ([Item [(Key, Value)]] -> [(Key, Value)]
forall l. IsList l => [Item l] -> l
Prelude.fromList
           ([Maybe (Key, Value)] -> [(Key, Value)]
forall a. [Maybe a] -> [a]
Prelude.catMaybes [Key -> [EventProperty] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Events" ([EventProperty] -> (Key, Value))
-> Maybe [EventProperty] -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EventProperty]
events]))
instance Property "Events" OnEnterProperty where
  type PropertyType "Events" OnEnterProperty = [EventProperty]
  set :: PropertyType "Events" OnEnterProperty
-> OnEnterProperty -> OnEnterProperty
set PropertyType "Events" OnEnterProperty
newValue OnEnterProperty {Maybe [EventProperty]
()
haddock_workaround_ :: OnEnterProperty -> ()
events :: OnEnterProperty -> Maybe [EventProperty]
haddock_workaround_ :: ()
events :: Maybe [EventProperty]
..}
    = OnEnterProperty {events :: Maybe [EventProperty]
events = [EventProperty] -> Maybe [EventProperty]
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure [EventProperty]
PropertyType "Events" OnEnterProperty
newValue, ()
haddock_workaround_ :: ()
haddock_workaround_ :: ()
..}