{-# 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.FraudDetector.Types.RuleResult where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RuleResult = RuleResult'
{
RuleResult -> Maybe Text
ruleId :: Prelude.Maybe Prelude.Text,
RuleResult -> Maybe [Text]
outcomes :: Prelude.Maybe [Prelude.Text]
}
deriving (RuleResult -> RuleResult -> Bool
(RuleResult -> RuleResult -> Bool)
-> (RuleResult -> RuleResult -> Bool) -> Eq RuleResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RuleResult -> RuleResult -> Bool
$c/= :: RuleResult -> RuleResult -> Bool
== :: RuleResult -> RuleResult -> Bool
$c== :: RuleResult -> RuleResult -> Bool
Prelude.Eq, ReadPrec [RuleResult]
ReadPrec RuleResult
Int -> ReadS RuleResult
ReadS [RuleResult]
(Int -> ReadS RuleResult)
-> ReadS [RuleResult]
-> ReadPrec RuleResult
-> ReadPrec [RuleResult]
-> Read RuleResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RuleResult]
$creadListPrec :: ReadPrec [RuleResult]
readPrec :: ReadPrec RuleResult
$creadPrec :: ReadPrec RuleResult
readList :: ReadS [RuleResult]
$creadList :: ReadS [RuleResult]
readsPrec :: Int -> ReadS RuleResult
$creadsPrec :: Int -> ReadS RuleResult
Prelude.Read, Int -> RuleResult -> ShowS
[RuleResult] -> ShowS
RuleResult -> String
(Int -> RuleResult -> ShowS)
-> (RuleResult -> String)
-> ([RuleResult] -> ShowS)
-> Show RuleResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RuleResult] -> ShowS
$cshowList :: [RuleResult] -> ShowS
show :: RuleResult -> String
$cshow :: RuleResult -> String
showsPrec :: Int -> RuleResult -> ShowS
$cshowsPrec :: Int -> RuleResult -> ShowS
Prelude.Show, (forall x. RuleResult -> Rep RuleResult x)
-> (forall x. Rep RuleResult x -> RuleResult) -> Generic RuleResult
forall x. Rep RuleResult x -> RuleResult
forall x. RuleResult -> Rep RuleResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RuleResult x -> RuleResult
$cfrom :: forall x. RuleResult -> Rep RuleResult x
Prelude.Generic)
newRuleResult ::
RuleResult
newRuleResult :: RuleResult
newRuleResult =
RuleResult' :: Maybe Text -> Maybe [Text] -> RuleResult
RuleResult'
{ $sel:ruleId:RuleResult' :: Maybe Text
ruleId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:outcomes:RuleResult' :: Maybe [Text]
outcomes = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
ruleResult_ruleId :: Lens.Lens' RuleResult (Prelude.Maybe Prelude.Text)
ruleResult_ruleId :: (Maybe Text -> f (Maybe Text)) -> RuleResult -> f RuleResult
ruleResult_ruleId = (RuleResult -> Maybe Text)
-> (RuleResult -> Maybe Text -> RuleResult)
-> Lens RuleResult RuleResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleResult' {Maybe Text
ruleId :: Maybe Text
$sel:ruleId:RuleResult' :: RuleResult -> Maybe Text
ruleId} -> Maybe Text
ruleId) (\s :: RuleResult
s@RuleResult' {} Maybe Text
a -> RuleResult
s {$sel:ruleId:RuleResult' :: Maybe Text
ruleId = Maybe Text
a} :: RuleResult)
ruleResult_outcomes :: Lens.Lens' RuleResult (Prelude.Maybe [Prelude.Text])
ruleResult_outcomes :: (Maybe [Text] -> f (Maybe [Text])) -> RuleResult -> f RuleResult
ruleResult_outcomes = (RuleResult -> Maybe [Text])
-> (RuleResult -> Maybe [Text] -> RuleResult)
-> Lens RuleResult RuleResult (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleResult' {Maybe [Text]
outcomes :: Maybe [Text]
$sel:outcomes:RuleResult' :: RuleResult -> Maybe [Text]
outcomes} -> Maybe [Text]
outcomes) (\s :: RuleResult
s@RuleResult' {} Maybe [Text]
a -> RuleResult
s {$sel:outcomes:RuleResult' :: Maybe [Text]
outcomes = Maybe [Text]
a} :: RuleResult) ((Maybe [Text] -> f (Maybe [Text])) -> RuleResult -> f RuleResult)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> RuleResult
-> f RuleResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON RuleResult where
parseJSON :: Value -> Parser RuleResult
parseJSON =
String
-> (Object -> Parser RuleResult) -> Value -> Parser RuleResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RuleResult"
( \Object
x ->
Maybe Text -> Maybe [Text] -> RuleResult
RuleResult'
(Maybe Text -> Maybe [Text] -> RuleResult)
-> Parser (Maybe Text) -> Parser (Maybe [Text] -> RuleResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ruleId")
Parser (Maybe [Text] -> RuleResult)
-> Parser (Maybe [Text]) -> Parser RuleResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outcomes" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable RuleResult
instance Prelude.NFData RuleResult