{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.VoiceId.Types.FraudDetectionConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(FraudDetectionConfiguration
 -> FraudDetectionConfiguration -> Bool)
-> (FraudDetectionConfiguration
    -> FraudDetectionConfiguration -> Bool)
-> Eq FraudDetectionConfiguration
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]
(Int -> ReadS FraudDetectionConfiguration)
-> ReadS [FraudDetectionConfiguration]
-> ReadPrec FraudDetectionConfiguration
-> ReadPrec [FraudDetectionConfiguration]
-> Read 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
(Int -> FraudDetectionConfiguration -> ShowS)
-> (FraudDetectionConfiguration -> String)
-> ([FraudDetectionConfiguration] -> ShowS)
-> Show FraudDetectionConfiguration
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.
 FraudDetectionConfiguration -> Rep FraudDetectionConfiguration x)
-> (forall x.
    Rep FraudDetectionConfiguration x -> FraudDetectionConfiguration)
-> Generic FraudDetectionConfiguration
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' :: Natural -> FraudDetectionConfiguration
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 :: (Natural -> f Natural)
-> FraudDetectionConfiguration -> f FraudDetectionConfiguration
fraudDetectionConfiguration_riskThreshold = (FraudDetectionConfiguration -> Natural)
-> (FraudDetectionConfiguration
    -> Natural -> FraudDetectionConfiguration)
-> Lens
     FraudDetectionConfiguration
     FraudDetectionConfiguration
     Natural
     Natural
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 Core.FromJSON FraudDetectionConfiguration where
  parseJSON :: Value -> Parser FraudDetectionConfiguration
parseJSON =
    String
-> (Object -> Parser FraudDetectionConfiguration)
-> Value
-> Parser FraudDetectionConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FraudDetectionConfiguration"
      ( \Object
x ->
          Natural -> FraudDetectionConfiguration
FraudDetectionConfiguration'
            (Natural -> FraudDetectionConfiguration)
-> Parser Natural -> Parser FraudDetectionConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RiskThreshold")
      )

instance Prelude.Hashable FraudDetectionConfiguration

instance Prelude.NFData FraudDetectionConfiguration