{-# 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.Connect.Types.Threshold where
import Amazonka.Connect.Types.Comparison
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data Threshold = Threshold'
{
Threshold -> Maybe Comparison
comparison :: Prelude.Maybe Comparison,
Threshold -> Maybe Double
thresholdValue :: Prelude.Maybe Prelude.Double
}
deriving (Threshold -> Threshold -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Threshold -> Threshold -> Bool
$c/= :: Threshold -> Threshold -> Bool
== :: Threshold -> Threshold -> Bool
$c== :: Threshold -> Threshold -> Bool
Prelude.Eq, ReadPrec [Threshold]
ReadPrec Threshold
Int -> ReadS Threshold
ReadS [Threshold]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Threshold]
$creadListPrec :: ReadPrec [Threshold]
readPrec :: ReadPrec Threshold
$creadPrec :: ReadPrec Threshold
readList :: ReadS [Threshold]
$creadList :: ReadS [Threshold]
readsPrec :: Int -> ReadS Threshold
$creadsPrec :: Int -> ReadS Threshold
Prelude.Read, Int -> Threshold -> ShowS
[Threshold] -> ShowS
Threshold -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Threshold] -> ShowS
$cshowList :: [Threshold] -> ShowS
show :: Threshold -> String
$cshow :: Threshold -> String
showsPrec :: Int -> Threshold -> ShowS
$cshowsPrec :: Int -> Threshold -> ShowS
Prelude.Show, forall x. Rep Threshold x -> Threshold
forall x. Threshold -> Rep Threshold x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Threshold x -> Threshold
$cfrom :: forall x. Threshold -> Rep Threshold x
Prelude.Generic)
newThreshold ::
Threshold
newThreshold :: Threshold
newThreshold =
Threshold'
{ $sel:comparison:Threshold' :: Maybe Comparison
comparison = forall a. Maybe a
Prelude.Nothing,
$sel:thresholdValue:Threshold' :: Maybe Double
thresholdValue = forall a. Maybe a
Prelude.Nothing
}
threshold_comparison :: Lens.Lens' Threshold (Prelude.Maybe Comparison)
threshold_comparison :: Lens' Threshold (Maybe Comparison)
threshold_comparison = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Threshold' {Maybe Comparison
comparison :: Maybe Comparison
$sel:comparison:Threshold' :: Threshold -> Maybe Comparison
comparison} -> Maybe Comparison
comparison) (\s :: Threshold
s@Threshold' {} Maybe Comparison
a -> Threshold
s {$sel:comparison:Threshold' :: Maybe Comparison
comparison = Maybe Comparison
a} :: Threshold)
threshold_thresholdValue :: Lens.Lens' Threshold (Prelude.Maybe Prelude.Double)
threshold_thresholdValue :: Lens' Threshold (Maybe Double)
threshold_thresholdValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Threshold' {Maybe Double
thresholdValue :: Maybe Double
$sel:thresholdValue:Threshold' :: Threshold -> Maybe Double
thresholdValue} -> Maybe Double
thresholdValue) (\s :: Threshold
s@Threshold' {} Maybe Double
a -> Threshold
s {$sel:thresholdValue:Threshold' :: Maybe Double
thresholdValue = Maybe Double
a} :: Threshold)
instance Data.FromJSON Threshold where
parseJSON :: Value -> Parser Threshold
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Threshold"
( \Object
x ->
Maybe Comparison -> Maybe Double -> Threshold
Threshold'
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
"Comparison")
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 Threshold where
hashWithSalt :: Int -> Threshold -> Int
hashWithSalt Int
_salt Threshold' {Maybe Double
Maybe Comparison
thresholdValue :: Maybe Double
comparison :: Maybe Comparison
$sel:thresholdValue:Threshold' :: Threshold -> Maybe Double
$sel:comparison:Threshold' :: Threshold -> Maybe Comparison
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Comparison
comparison
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
thresholdValue
instance Prelude.NFData Threshold where
rnf :: Threshold -> ()
rnf Threshold' {Maybe Double
Maybe Comparison
thresholdValue :: Maybe Double
comparison :: Maybe Comparison
$sel:thresholdValue:Threshold' :: Threshold -> Maybe Double
$sel:comparison:Threshold' :: Threshold -> Maybe Comparison
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Comparison
comparison
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
thresholdValue
instance Data.ToJSON Threshold where
toJSON :: Threshold -> Value
toJSON Threshold' {Maybe Double
Maybe Comparison
thresholdValue :: Maybe Double
comparison :: Maybe Comparison
$sel:thresholdValue:Threshold' :: Threshold -> Maybe Double
$sel:comparison:Threshold' :: Threshold -> Maybe Comparison
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Comparison" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Comparison
comparison,
(Key
"ThresholdValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
thresholdValue
]
)