{-# 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.FraudDetector.Types.VariableImpactExplanation
-- 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.FraudDetector.Types.VariableImpactExplanation where

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

-- | The details of the event variable\'s impact on the prediction score.
--
-- /See:/ 'newVariableImpactExplanation' smart constructor.
data VariableImpactExplanation = VariableImpactExplanation'
  { -- | The event variable name.
    VariableImpactExplanation -> Maybe Text
eventVariableName :: Prelude.Maybe Prelude.Text,
    -- | The raw, uninterpreted value represented as log-odds of the fraud. These
    -- values are usually between -10 to +10, but range from - infinity to +
    -- infinity.
    --
    -- -   A positive value indicates that the variable drove the risk score
    --     up.
    --
    -- -   A negative value indicates that the variable drove the risk score
    --     down.
    VariableImpactExplanation -> Maybe Double
logOddsImpact :: Prelude.Maybe Prelude.Double,
    -- | The event variable\'s relative impact in terms of magnitude on the
    -- prediction scores. The relative impact values consist of a numerical
    -- rating (0-5, 5 being the highest) and direction (increased\/decreased)
    -- impact of the fraud risk.
    VariableImpactExplanation -> Maybe Text
relativeImpact :: Prelude.Maybe Prelude.Text
  }
  deriving (VariableImpactExplanation -> VariableImpactExplanation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VariableImpactExplanation -> VariableImpactExplanation -> Bool
$c/= :: VariableImpactExplanation -> VariableImpactExplanation -> Bool
== :: VariableImpactExplanation -> VariableImpactExplanation -> Bool
$c== :: VariableImpactExplanation -> VariableImpactExplanation -> Bool
Prelude.Eq, ReadPrec [VariableImpactExplanation]
ReadPrec VariableImpactExplanation
Int -> ReadS VariableImpactExplanation
ReadS [VariableImpactExplanation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VariableImpactExplanation]
$creadListPrec :: ReadPrec [VariableImpactExplanation]
readPrec :: ReadPrec VariableImpactExplanation
$creadPrec :: ReadPrec VariableImpactExplanation
readList :: ReadS [VariableImpactExplanation]
$creadList :: ReadS [VariableImpactExplanation]
readsPrec :: Int -> ReadS VariableImpactExplanation
$creadsPrec :: Int -> ReadS VariableImpactExplanation
Prelude.Read, Int -> VariableImpactExplanation -> ShowS
[VariableImpactExplanation] -> ShowS
VariableImpactExplanation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VariableImpactExplanation] -> ShowS
$cshowList :: [VariableImpactExplanation] -> ShowS
show :: VariableImpactExplanation -> String
$cshow :: VariableImpactExplanation -> String
showsPrec :: Int -> VariableImpactExplanation -> ShowS
$cshowsPrec :: Int -> VariableImpactExplanation -> ShowS
Prelude.Show, forall x.
Rep VariableImpactExplanation x -> VariableImpactExplanation
forall x.
VariableImpactExplanation -> Rep VariableImpactExplanation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VariableImpactExplanation x -> VariableImpactExplanation
$cfrom :: forall x.
VariableImpactExplanation -> Rep VariableImpactExplanation x
Prelude.Generic)

-- |
-- Create a value of 'VariableImpactExplanation' 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:
--
-- 'eventVariableName', 'variableImpactExplanation_eventVariableName' - The event variable name.
--
-- 'logOddsImpact', 'variableImpactExplanation_logOddsImpact' - The raw, uninterpreted value represented as log-odds of the fraud. These
-- values are usually between -10 to +10, but range from - infinity to +
-- infinity.
--
-- -   A positive value indicates that the variable drove the risk score
--     up.
--
-- -   A negative value indicates that the variable drove the risk score
--     down.
--
-- 'relativeImpact', 'variableImpactExplanation_relativeImpact' - The event variable\'s relative impact in terms of magnitude on the
-- prediction scores. The relative impact values consist of a numerical
-- rating (0-5, 5 being the highest) and direction (increased\/decreased)
-- impact of the fraud risk.
newVariableImpactExplanation ::
  VariableImpactExplanation
newVariableImpactExplanation :: VariableImpactExplanation
newVariableImpactExplanation =
  VariableImpactExplanation'
    { $sel:eventVariableName:VariableImpactExplanation' :: Maybe Text
eventVariableName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:logOddsImpact:VariableImpactExplanation' :: Maybe Double
logOddsImpact = forall a. Maybe a
Prelude.Nothing,
      $sel:relativeImpact:VariableImpactExplanation' :: Maybe Text
relativeImpact = forall a. Maybe a
Prelude.Nothing
    }

-- | The event variable name.
variableImpactExplanation_eventVariableName :: Lens.Lens' VariableImpactExplanation (Prelude.Maybe Prelude.Text)
variableImpactExplanation_eventVariableName :: Lens' VariableImpactExplanation (Maybe Text)
variableImpactExplanation_eventVariableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VariableImpactExplanation' {Maybe Text
eventVariableName :: Maybe Text
$sel:eventVariableName:VariableImpactExplanation' :: VariableImpactExplanation -> Maybe Text
eventVariableName} -> Maybe Text
eventVariableName) (\s :: VariableImpactExplanation
s@VariableImpactExplanation' {} Maybe Text
a -> VariableImpactExplanation
s {$sel:eventVariableName:VariableImpactExplanation' :: Maybe Text
eventVariableName = Maybe Text
a} :: VariableImpactExplanation)

-- | The raw, uninterpreted value represented as log-odds of the fraud. These
-- values are usually between -10 to +10, but range from - infinity to +
-- infinity.
--
-- -   A positive value indicates that the variable drove the risk score
--     up.
--
-- -   A negative value indicates that the variable drove the risk score
--     down.
variableImpactExplanation_logOddsImpact :: Lens.Lens' VariableImpactExplanation (Prelude.Maybe Prelude.Double)
variableImpactExplanation_logOddsImpact :: Lens' VariableImpactExplanation (Maybe Double)
variableImpactExplanation_logOddsImpact = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VariableImpactExplanation' {Maybe Double
logOddsImpact :: Maybe Double
$sel:logOddsImpact:VariableImpactExplanation' :: VariableImpactExplanation -> Maybe Double
logOddsImpact} -> Maybe Double
logOddsImpact) (\s :: VariableImpactExplanation
s@VariableImpactExplanation' {} Maybe Double
a -> VariableImpactExplanation
s {$sel:logOddsImpact:VariableImpactExplanation' :: Maybe Double
logOddsImpact = Maybe Double
a} :: VariableImpactExplanation)

-- | The event variable\'s relative impact in terms of magnitude on the
-- prediction scores. The relative impact values consist of a numerical
-- rating (0-5, 5 being the highest) and direction (increased\/decreased)
-- impact of the fraud risk.
variableImpactExplanation_relativeImpact :: Lens.Lens' VariableImpactExplanation (Prelude.Maybe Prelude.Text)
variableImpactExplanation_relativeImpact :: Lens' VariableImpactExplanation (Maybe Text)
variableImpactExplanation_relativeImpact = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VariableImpactExplanation' {Maybe Text
relativeImpact :: Maybe Text
$sel:relativeImpact:VariableImpactExplanation' :: VariableImpactExplanation -> Maybe Text
relativeImpact} -> Maybe Text
relativeImpact) (\s :: VariableImpactExplanation
s@VariableImpactExplanation' {} Maybe Text
a -> VariableImpactExplanation
s {$sel:relativeImpact:VariableImpactExplanation' :: Maybe Text
relativeImpact = Maybe Text
a} :: VariableImpactExplanation)

instance Data.FromJSON VariableImpactExplanation where
  parseJSON :: Value -> Parser VariableImpactExplanation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VariableImpactExplanation"
      ( \Object
x ->
          Maybe Text
-> Maybe Double -> Maybe Text -> VariableImpactExplanation
VariableImpactExplanation'
            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
"eventVariableName")
            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
"logOddsImpact")
            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
"relativeImpact")
      )

instance Prelude.Hashable VariableImpactExplanation where
  hashWithSalt :: Int -> VariableImpactExplanation -> Int
hashWithSalt Int
_salt VariableImpactExplanation' {Maybe Double
Maybe Text
relativeImpact :: Maybe Text
logOddsImpact :: Maybe Double
eventVariableName :: Maybe Text
$sel:relativeImpact:VariableImpactExplanation' :: VariableImpactExplanation -> Maybe Text
$sel:logOddsImpact:VariableImpactExplanation' :: VariableImpactExplanation -> Maybe Double
$sel:eventVariableName:VariableImpactExplanation' :: VariableImpactExplanation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eventVariableName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
logOddsImpact
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
relativeImpact

instance Prelude.NFData VariableImpactExplanation where
  rnf :: VariableImpactExplanation -> ()
rnf VariableImpactExplanation' {Maybe Double
Maybe Text
relativeImpact :: Maybe Text
logOddsImpact :: Maybe Double
eventVariableName :: Maybe Text
$sel:relativeImpact:VariableImpactExplanation' :: VariableImpactExplanation -> Maybe Text
$sel:logOddsImpact:VariableImpactExplanation' :: VariableImpactExplanation -> Maybe Double
$sel:eventVariableName:VariableImpactExplanation' :: VariableImpactExplanation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eventVariableName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
logOddsImpact
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
relativeImpact