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

import qualified Amazonka.Core as Core
import Amazonka.IoTEventsData.Types.SimpleRuleEvaluation
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information needed to evaluate data.
--
-- /See:/ 'newRuleEvaluation' smart constructor.
data RuleEvaluation = RuleEvaluation'
  { -- | Information needed to compare two values with a comparison operator.
    RuleEvaluation -> Maybe SimpleRuleEvaluation
simpleRuleEvaluation :: Prelude.Maybe SimpleRuleEvaluation
  }
  deriving (RuleEvaluation -> RuleEvaluation -> Bool
(RuleEvaluation -> RuleEvaluation -> Bool)
-> (RuleEvaluation -> RuleEvaluation -> Bool) -> Eq RuleEvaluation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RuleEvaluation -> RuleEvaluation -> Bool
$c/= :: RuleEvaluation -> RuleEvaluation -> Bool
== :: RuleEvaluation -> RuleEvaluation -> Bool
$c== :: RuleEvaluation -> RuleEvaluation -> Bool
Prelude.Eq, ReadPrec [RuleEvaluation]
ReadPrec RuleEvaluation
Int -> ReadS RuleEvaluation
ReadS [RuleEvaluation]
(Int -> ReadS RuleEvaluation)
-> ReadS [RuleEvaluation]
-> ReadPrec RuleEvaluation
-> ReadPrec [RuleEvaluation]
-> Read RuleEvaluation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RuleEvaluation]
$creadListPrec :: ReadPrec [RuleEvaluation]
readPrec :: ReadPrec RuleEvaluation
$creadPrec :: ReadPrec RuleEvaluation
readList :: ReadS [RuleEvaluation]
$creadList :: ReadS [RuleEvaluation]
readsPrec :: Int -> ReadS RuleEvaluation
$creadsPrec :: Int -> ReadS RuleEvaluation
Prelude.Read, Int -> RuleEvaluation -> ShowS
[RuleEvaluation] -> ShowS
RuleEvaluation -> String
(Int -> RuleEvaluation -> ShowS)
-> (RuleEvaluation -> String)
-> ([RuleEvaluation] -> ShowS)
-> Show RuleEvaluation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RuleEvaluation] -> ShowS
$cshowList :: [RuleEvaluation] -> ShowS
show :: RuleEvaluation -> String
$cshow :: RuleEvaluation -> String
showsPrec :: Int -> RuleEvaluation -> ShowS
$cshowsPrec :: Int -> RuleEvaluation -> ShowS
Prelude.Show, (forall x. RuleEvaluation -> Rep RuleEvaluation x)
-> (forall x. Rep RuleEvaluation x -> RuleEvaluation)
-> Generic RuleEvaluation
forall x. Rep RuleEvaluation x -> RuleEvaluation
forall x. RuleEvaluation -> Rep RuleEvaluation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RuleEvaluation x -> RuleEvaluation
$cfrom :: forall x. RuleEvaluation -> Rep RuleEvaluation x
Prelude.Generic)

-- |
-- Create a value of 'RuleEvaluation' 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:
--
-- 'simpleRuleEvaluation', 'ruleEvaluation_simpleRuleEvaluation' - Information needed to compare two values with a comparison operator.
newRuleEvaluation ::
  RuleEvaluation
newRuleEvaluation :: RuleEvaluation
newRuleEvaluation =
  RuleEvaluation' :: Maybe SimpleRuleEvaluation -> RuleEvaluation
RuleEvaluation'
    { $sel:simpleRuleEvaluation:RuleEvaluation' :: Maybe SimpleRuleEvaluation
simpleRuleEvaluation =
        Maybe SimpleRuleEvaluation
forall a. Maybe a
Prelude.Nothing
    }

-- | Information needed to compare two values with a comparison operator.
ruleEvaluation_simpleRuleEvaluation :: Lens.Lens' RuleEvaluation (Prelude.Maybe SimpleRuleEvaluation)
ruleEvaluation_simpleRuleEvaluation :: (Maybe SimpleRuleEvaluation -> f (Maybe SimpleRuleEvaluation))
-> RuleEvaluation -> f RuleEvaluation
ruleEvaluation_simpleRuleEvaluation = (RuleEvaluation -> Maybe SimpleRuleEvaluation)
-> (RuleEvaluation -> Maybe SimpleRuleEvaluation -> RuleEvaluation)
-> Lens
     RuleEvaluation
     RuleEvaluation
     (Maybe SimpleRuleEvaluation)
     (Maybe SimpleRuleEvaluation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleEvaluation' {Maybe SimpleRuleEvaluation
simpleRuleEvaluation :: Maybe SimpleRuleEvaluation
$sel:simpleRuleEvaluation:RuleEvaluation' :: RuleEvaluation -> Maybe SimpleRuleEvaluation
simpleRuleEvaluation} -> Maybe SimpleRuleEvaluation
simpleRuleEvaluation) (\s :: RuleEvaluation
s@RuleEvaluation' {} Maybe SimpleRuleEvaluation
a -> RuleEvaluation
s {$sel:simpleRuleEvaluation:RuleEvaluation' :: Maybe SimpleRuleEvaluation
simpleRuleEvaluation = Maybe SimpleRuleEvaluation
a} :: RuleEvaluation)

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

instance Prelude.Hashable RuleEvaluation

instance Prelude.NFData RuleEvaluation