{-# 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.VoiceId.Types.FraudDetectionConfiguration
-- 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.VoiceId.Types.FraudDetectionConfiguration 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 configuration used for performing fraud detection over a speaker
-- during a session.
--
-- /See:/ 'newFraudDetectionConfiguration' smart constructor.
data FraudDetectionConfiguration = FraudDetectionConfiguration'
  { -- | Threshold value for determining whether the speaker is a fraudster. If
    -- the detected risk score calculated by Voice ID is higher than the
    -- threshold, the speaker is considered a fraudster.
    FraudDetectionConfiguration -> Natural
riskThreshold :: Prelude.Natural
  }
  deriving (FraudDetectionConfiguration -> FraudDetectionConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FraudDetectionConfiguration -> FraudDetectionConfiguration -> Bool
$c/= :: FraudDetectionConfiguration -> FraudDetectionConfiguration -> Bool
== :: FraudDetectionConfiguration -> FraudDetectionConfiguration -> Bool
$c== :: FraudDetectionConfiguration -> FraudDetectionConfiguration -> Bool
Prelude.Eq, ReadPrec [FraudDetectionConfiguration]
ReadPrec FraudDetectionConfiguration
Int -> ReadS FraudDetectionConfiguration
ReadS [FraudDetectionConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FraudDetectionConfiguration]
$creadListPrec :: ReadPrec [FraudDetectionConfiguration]
readPrec :: ReadPrec FraudDetectionConfiguration
$creadPrec :: ReadPrec FraudDetectionConfiguration
readList :: ReadS [FraudDetectionConfiguration]
$creadList :: ReadS [FraudDetectionConfiguration]
readsPrec :: Int -> ReadS FraudDetectionConfiguration
$creadsPrec :: Int -> ReadS FraudDetectionConfiguration
Prelude.Read, Int -> FraudDetectionConfiguration -> ShowS
[FraudDetectionConfiguration] -> ShowS
FraudDetectionConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FraudDetectionConfiguration] -> ShowS
$cshowList :: [FraudDetectionConfiguration] -> ShowS
show :: FraudDetectionConfiguration -> String
$cshow :: FraudDetectionConfiguration -> String
showsPrec :: Int -> FraudDetectionConfiguration -> ShowS
$cshowsPrec :: Int -> FraudDetectionConfiguration -> ShowS
Prelude.Show, forall x.
Rep FraudDetectionConfiguration x -> FraudDetectionConfiguration
forall x.
FraudDetectionConfiguration -> Rep FraudDetectionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FraudDetectionConfiguration x -> FraudDetectionConfiguration
$cfrom :: forall x.
FraudDetectionConfiguration -> Rep FraudDetectionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'FraudDetectionConfiguration' 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:
--
-- 'riskThreshold', 'fraudDetectionConfiguration_riskThreshold' - Threshold value for determining whether the speaker is a fraudster. If
-- the detected risk score calculated by Voice ID is higher than the
-- threshold, the speaker is considered a fraudster.
newFraudDetectionConfiguration ::
  -- | 'riskThreshold'
  Prelude.Natural ->
  FraudDetectionConfiguration
newFraudDetectionConfiguration :: Natural -> FraudDetectionConfiguration
newFraudDetectionConfiguration Natural
pRiskThreshold_ =
  FraudDetectionConfiguration'
    { $sel:riskThreshold:FraudDetectionConfiguration' :: Natural
riskThreshold =
        Natural
pRiskThreshold_
    }

-- | Threshold value for determining whether the speaker is a fraudster. If
-- the detected risk score calculated by Voice ID is higher than the
-- threshold, the speaker is considered a fraudster.
fraudDetectionConfiguration_riskThreshold :: Lens.Lens' FraudDetectionConfiguration Prelude.Natural
fraudDetectionConfiguration_riskThreshold :: Lens' FraudDetectionConfiguration Natural
fraudDetectionConfiguration_riskThreshold = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FraudDetectionConfiguration' {Natural
riskThreshold :: Natural
$sel:riskThreshold:FraudDetectionConfiguration' :: FraudDetectionConfiguration -> Natural
riskThreshold} -> Natural
riskThreshold) (\s :: FraudDetectionConfiguration
s@FraudDetectionConfiguration' {} Natural
a -> FraudDetectionConfiguration
s {$sel:riskThreshold:FraudDetectionConfiguration' :: Natural
riskThreshold = Natural
a} :: FraudDetectionConfiguration)

instance Data.FromJSON FraudDetectionConfiguration where
  parseJSON :: Value -> Parser FraudDetectionConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FraudDetectionConfiguration"
      ( \Object
x ->
          Natural -> FraudDetectionConfiguration
FraudDetectionConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"RiskThreshold")
      )

instance Prelude.Hashable FraudDetectionConfiguration where
  hashWithSalt :: Int -> FraudDetectionConfiguration -> Int
hashWithSalt Int
_salt FraudDetectionConfiguration' {Natural
riskThreshold :: Natural
$sel:riskThreshold:FraudDetectionConfiguration' :: FraudDetectionConfiguration -> Natural
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
riskThreshold

instance Prelude.NFData FraudDetectionConfiguration where
  rnf :: FraudDetectionConfiguration -> ()
rnf FraudDetectionConfiguration' {Natural
riskThreshold :: Natural
$sel:riskThreshold:FraudDetectionConfiguration' :: FraudDetectionConfiguration -> Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Natural
riskThreshold