{-# 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.SimpleRuleEvaluation
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTEventsData.Types.SimpleRuleEvaluation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTEventsData.Types.ComparisonOperator
import qualified Amazonka.Prelude as Prelude

-- | Information needed to compare two values with a comparison operator.
--
-- /See:/ 'newSimpleRuleEvaluation' smart constructor.
data SimpleRuleEvaluation = SimpleRuleEvaluation'
  { -- | The value of the input property, on the left side of the comparison
    -- operator.
    SimpleRuleEvaluation -> Maybe Text
inputPropertyValue :: Prelude.Maybe Prelude.Text,
    -- | The comparison operator.
    SimpleRuleEvaluation -> Maybe ComparisonOperator
operator :: Prelude.Maybe ComparisonOperator,
    -- | The threshold value, on the right side of the comparison operator.
    SimpleRuleEvaluation -> Maybe Text
thresholdValue :: Prelude.Maybe Prelude.Text
  }
  deriving (SimpleRuleEvaluation -> SimpleRuleEvaluation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SimpleRuleEvaluation -> SimpleRuleEvaluation -> Bool
$c/= :: SimpleRuleEvaluation -> SimpleRuleEvaluation -> Bool
== :: SimpleRuleEvaluation -> SimpleRuleEvaluation -> Bool
$c== :: SimpleRuleEvaluation -> SimpleRuleEvaluation -> Bool
Prelude.Eq, ReadPrec [SimpleRuleEvaluation]
ReadPrec SimpleRuleEvaluation
Int -> ReadS SimpleRuleEvaluation
ReadS [SimpleRuleEvaluation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SimpleRuleEvaluation]
$creadListPrec :: ReadPrec [SimpleRuleEvaluation]
readPrec :: ReadPrec SimpleRuleEvaluation
$creadPrec :: ReadPrec SimpleRuleEvaluation
readList :: ReadS [SimpleRuleEvaluation]
$creadList :: ReadS [SimpleRuleEvaluation]
readsPrec :: Int -> ReadS SimpleRuleEvaluation
$creadsPrec :: Int -> ReadS SimpleRuleEvaluation
Prelude.Read, Int -> SimpleRuleEvaluation -> ShowS
[SimpleRuleEvaluation] -> ShowS
SimpleRuleEvaluation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SimpleRuleEvaluation] -> ShowS
$cshowList :: [SimpleRuleEvaluation] -> ShowS
show :: SimpleRuleEvaluation -> String
$cshow :: SimpleRuleEvaluation -> String
showsPrec :: Int -> SimpleRuleEvaluation -> ShowS
$cshowsPrec :: Int -> SimpleRuleEvaluation -> ShowS
Prelude.Show, forall x. Rep SimpleRuleEvaluation x -> SimpleRuleEvaluation
forall x. SimpleRuleEvaluation -> Rep SimpleRuleEvaluation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SimpleRuleEvaluation x -> SimpleRuleEvaluation
$cfrom :: forall x. SimpleRuleEvaluation -> Rep SimpleRuleEvaluation x
Prelude.Generic)

-- |
-- Create a value of 'SimpleRuleEvaluation' 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:
--
-- 'inputPropertyValue', 'simpleRuleEvaluation_inputPropertyValue' - The value of the input property, on the left side of the comparison
-- operator.
--
-- 'operator', 'simpleRuleEvaluation_operator' - The comparison operator.
--
-- 'thresholdValue', 'simpleRuleEvaluation_thresholdValue' - The threshold value, on the right side of the comparison operator.
newSimpleRuleEvaluation ::
  SimpleRuleEvaluation
newSimpleRuleEvaluation :: SimpleRuleEvaluation
newSimpleRuleEvaluation =
  SimpleRuleEvaluation'
    { $sel:inputPropertyValue:SimpleRuleEvaluation' :: Maybe Text
inputPropertyValue =
        forall a. Maybe a
Prelude.Nothing,
      $sel:operator:SimpleRuleEvaluation' :: Maybe ComparisonOperator
operator = forall a. Maybe a
Prelude.Nothing,
      $sel:thresholdValue:SimpleRuleEvaluation' :: Maybe Text
thresholdValue = forall a. Maybe a
Prelude.Nothing
    }

-- | The value of the input property, on the left side of the comparison
-- operator.
simpleRuleEvaluation_inputPropertyValue :: Lens.Lens' SimpleRuleEvaluation (Prelude.Maybe Prelude.Text)
simpleRuleEvaluation_inputPropertyValue :: Lens' SimpleRuleEvaluation (Maybe Text)
simpleRuleEvaluation_inputPropertyValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SimpleRuleEvaluation' {Maybe Text
inputPropertyValue :: Maybe Text
$sel:inputPropertyValue:SimpleRuleEvaluation' :: SimpleRuleEvaluation -> Maybe Text
inputPropertyValue} -> Maybe Text
inputPropertyValue) (\s :: SimpleRuleEvaluation
s@SimpleRuleEvaluation' {} Maybe Text
a -> SimpleRuleEvaluation
s {$sel:inputPropertyValue:SimpleRuleEvaluation' :: Maybe Text
inputPropertyValue = Maybe Text
a} :: SimpleRuleEvaluation)

-- | The comparison operator.
simpleRuleEvaluation_operator :: Lens.Lens' SimpleRuleEvaluation (Prelude.Maybe ComparisonOperator)
simpleRuleEvaluation_operator :: Lens' SimpleRuleEvaluation (Maybe ComparisonOperator)
simpleRuleEvaluation_operator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SimpleRuleEvaluation' {Maybe ComparisonOperator
operator :: Maybe ComparisonOperator
$sel:operator:SimpleRuleEvaluation' :: SimpleRuleEvaluation -> Maybe ComparisonOperator
operator} -> Maybe ComparisonOperator
operator) (\s :: SimpleRuleEvaluation
s@SimpleRuleEvaluation' {} Maybe ComparisonOperator
a -> SimpleRuleEvaluation
s {$sel:operator:SimpleRuleEvaluation' :: Maybe ComparisonOperator
operator = Maybe ComparisonOperator
a} :: SimpleRuleEvaluation)

-- | The threshold value, on the right side of the comparison operator.
simpleRuleEvaluation_thresholdValue :: Lens.Lens' SimpleRuleEvaluation (Prelude.Maybe Prelude.Text)
simpleRuleEvaluation_thresholdValue :: Lens' SimpleRuleEvaluation (Maybe Text)
simpleRuleEvaluation_thresholdValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SimpleRuleEvaluation' {Maybe Text
thresholdValue :: Maybe Text
$sel:thresholdValue:SimpleRuleEvaluation' :: SimpleRuleEvaluation -> Maybe Text
thresholdValue} -> Maybe Text
thresholdValue) (\s :: SimpleRuleEvaluation
s@SimpleRuleEvaluation' {} Maybe Text
a -> SimpleRuleEvaluation
s {$sel:thresholdValue:SimpleRuleEvaluation' :: Maybe Text
thresholdValue = Maybe Text
a} :: SimpleRuleEvaluation)

instance Data.FromJSON SimpleRuleEvaluation where
  parseJSON :: Value -> Parser SimpleRuleEvaluation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SimpleRuleEvaluation"
      ( \Object
x ->
          Maybe Text
-> Maybe ComparisonOperator -> Maybe Text -> SimpleRuleEvaluation
SimpleRuleEvaluation'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"inputPropertyValue")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"operator")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"thresholdValue")
      )

instance Prelude.Hashable SimpleRuleEvaluation where
  hashWithSalt :: Int -> SimpleRuleEvaluation -> Int
hashWithSalt Int
_salt SimpleRuleEvaluation' {Maybe Text
Maybe ComparisonOperator
thresholdValue :: Maybe Text
operator :: Maybe ComparisonOperator
inputPropertyValue :: Maybe Text
$sel:thresholdValue:SimpleRuleEvaluation' :: SimpleRuleEvaluation -> Maybe Text
$sel:operator:SimpleRuleEvaluation' :: SimpleRuleEvaluation -> Maybe ComparisonOperator
$sel:inputPropertyValue:SimpleRuleEvaluation' :: SimpleRuleEvaluation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inputPropertyValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ComparisonOperator
operator
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thresholdValue

instance Prelude.NFData SimpleRuleEvaluation where
  rnf :: SimpleRuleEvaluation -> ()
rnf SimpleRuleEvaluation' {Maybe Text
Maybe ComparisonOperator
thresholdValue :: Maybe Text
operator :: Maybe ComparisonOperator
inputPropertyValue :: Maybe Text
$sel:thresholdValue:SimpleRuleEvaluation' :: SimpleRuleEvaluation -> Maybe Text
$sel:operator:SimpleRuleEvaluation' :: SimpleRuleEvaluation -> Maybe ComparisonOperator
$sel:inputPropertyValue:SimpleRuleEvaluation' :: SimpleRuleEvaluation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inputPropertyValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ComparisonOperator
operator
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thresholdValue