{-# 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.CognitoIdentityProvider.Types.EventRiskType
-- 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.CognitoIdentityProvider.Types.EventRiskType where

import Amazonka.CognitoIdentityProvider.Types.RiskDecisionType
import Amazonka.CognitoIdentityProvider.Types.RiskLevelType
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 event risk type.
--
-- /See:/ 'newEventRiskType' smart constructor.
data EventRiskType = EventRiskType'
  { -- | Indicates whether compromised credentials were detected during an
    -- authentication event.
    EventRiskType -> Maybe Bool
compromisedCredentialsDetected :: Prelude.Maybe Prelude.Bool,
    -- | The risk decision.
    EventRiskType -> Maybe RiskDecisionType
riskDecision :: Prelude.Maybe RiskDecisionType,
    -- | The risk level.
    EventRiskType -> Maybe RiskLevelType
riskLevel :: Prelude.Maybe RiskLevelType
  }
  deriving (EventRiskType -> EventRiskType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventRiskType -> EventRiskType -> Bool
$c/= :: EventRiskType -> EventRiskType -> Bool
== :: EventRiskType -> EventRiskType -> Bool
$c== :: EventRiskType -> EventRiskType -> Bool
Prelude.Eq, ReadPrec [EventRiskType]
ReadPrec EventRiskType
Int -> ReadS EventRiskType
ReadS [EventRiskType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventRiskType]
$creadListPrec :: ReadPrec [EventRiskType]
readPrec :: ReadPrec EventRiskType
$creadPrec :: ReadPrec EventRiskType
readList :: ReadS [EventRiskType]
$creadList :: ReadS [EventRiskType]
readsPrec :: Int -> ReadS EventRiskType
$creadsPrec :: Int -> ReadS EventRiskType
Prelude.Read, Int -> EventRiskType -> ShowS
[EventRiskType] -> ShowS
EventRiskType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventRiskType] -> ShowS
$cshowList :: [EventRiskType] -> ShowS
show :: EventRiskType -> String
$cshow :: EventRiskType -> String
showsPrec :: Int -> EventRiskType -> ShowS
$cshowsPrec :: Int -> EventRiskType -> ShowS
Prelude.Show, forall x. Rep EventRiskType x -> EventRiskType
forall x. EventRiskType -> Rep EventRiskType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventRiskType x -> EventRiskType
$cfrom :: forall x. EventRiskType -> Rep EventRiskType x
Prelude.Generic)

-- |
-- Create a value of 'EventRiskType' 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:
--
-- 'compromisedCredentialsDetected', 'eventRiskType_compromisedCredentialsDetected' - Indicates whether compromised credentials were detected during an
-- authentication event.
--
-- 'riskDecision', 'eventRiskType_riskDecision' - The risk decision.
--
-- 'riskLevel', 'eventRiskType_riskLevel' - The risk level.
newEventRiskType ::
  EventRiskType
newEventRiskType :: EventRiskType
newEventRiskType =
  EventRiskType'
    { $sel:compromisedCredentialsDetected:EventRiskType' :: Maybe Bool
compromisedCredentialsDetected =
        forall a. Maybe a
Prelude.Nothing,
      $sel:riskDecision:EventRiskType' :: Maybe RiskDecisionType
riskDecision = forall a. Maybe a
Prelude.Nothing,
      $sel:riskLevel:EventRiskType' :: Maybe RiskLevelType
riskLevel = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether compromised credentials were detected during an
-- authentication event.
eventRiskType_compromisedCredentialsDetected :: Lens.Lens' EventRiskType (Prelude.Maybe Prelude.Bool)
eventRiskType_compromisedCredentialsDetected :: Lens' EventRiskType (Maybe Bool)
eventRiskType_compromisedCredentialsDetected = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventRiskType' {Maybe Bool
compromisedCredentialsDetected :: Maybe Bool
$sel:compromisedCredentialsDetected:EventRiskType' :: EventRiskType -> Maybe Bool
compromisedCredentialsDetected} -> Maybe Bool
compromisedCredentialsDetected) (\s :: EventRiskType
s@EventRiskType' {} Maybe Bool
a -> EventRiskType
s {$sel:compromisedCredentialsDetected:EventRiskType' :: Maybe Bool
compromisedCredentialsDetected = Maybe Bool
a} :: EventRiskType)

-- | The risk decision.
eventRiskType_riskDecision :: Lens.Lens' EventRiskType (Prelude.Maybe RiskDecisionType)
eventRiskType_riskDecision :: Lens' EventRiskType (Maybe RiskDecisionType)
eventRiskType_riskDecision = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventRiskType' {Maybe RiskDecisionType
riskDecision :: Maybe RiskDecisionType
$sel:riskDecision:EventRiskType' :: EventRiskType -> Maybe RiskDecisionType
riskDecision} -> Maybe RiskDecisionType
riskDecision) (\s :: EventRiskType
s@EventRiskType' {} Maybe RiskDecisionType
a -> EventRiskType
s {$sel:riskDecision:EventRiskType' :: Maybe RiskDecisionType
riskDecision = Maybe RiskDecisionType
a} :: EventRiskType)

-- | The risk level.
eventRiskType_riskLevel :: Lens.Lens' EventRiskType (Prelude.Maybe RiskLevelType)
eventRiskType_riskLevel :: Lens' EventRiskType (Maybe RiskLevelType)
eventRiskType_riskLevel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventRiskType' {Maybe RiskLevelType
riskLevel :: Maybe RiskLevelType
$sel:riskLevel:EventRiskType' :: EventRiskType -> Maybe RiskLevelType
riskLevel} -> Maybe RiskLevelType
riskLevel) (\s :: EventRiskType
s@EventRiskType' {} Maybe RiskLevelType
a -> EventRiskType
s {$sel:riskLevel:EventRiskType' :: Maybe RiskLevelType
riskLevel = Maybe RiskLevelType
a} :: EventRiskType)

instance Data.FromJSON EventRiskType where
  parseJSON :: Value -> Parser EventRiskType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EventRiskType"
      ( \Object
x ->
          Maybe Bool
-> Maybe RiskDecisionType -> Maybe RiskLevelType -> EventRiskType
EventRiskType'
            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
"CompromisedCredentialsDetected")
            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
"RiskDecision")
            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
"RiskLevel")
      )

instance Prelude.Hashable EventRiskType where
  hashWithSalt :: Int -> EventRiskType -> Int
hashWithSalt Int
_salt EventRiskType' {Maybe Bool
Maybe RiskDecisionType
Maybe RiskLevelType
riskLevel :: Maybe RiskLevelType
riskDecision :: Maybe RiskDecisionType
compromisedCredentialsDetected :: Maybe Bool
$sel:riskLevel:EventRiskType' :: EventRiskType -> Maybe RiskLevelType
$sel:riskDecision:EventRiskType' :: EventRiskType -> Maybe RiskDecisionType
$sel:compromisedCredentialsDetected:EventRiskType' :: EventRiskType -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
compromisedCredentialsDetected
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RiskDecisionType
riskDecision
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RiskLevelType
riskLevel

instance Prelude.NFData EventRiskType where
  rnf :: EventRiskType -> ()
rnf EventRiskType' {Maybe Bool
Maybe RiskDecisionType
Maybe RiskLevelType
riskLevel :: Maybe RiskLevelType
riskDecision :: Maybe RiskDecisionType
compromisedCredentialsDetected :: Maybe Bool
$sel:riskLevel:EventRiskType' :: EventRiskType -> Maybe RiskLevelType
$sel:riskDecision:EventRiskType' :: EventRiskType -> Maybe RiskDecisionType
$sel:compromisedCredentialsDetected:EventRiskType' :: EventRiskType -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
compromisedCredentialsDetected
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RiskDecisionType
riskDecision
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RiskLevelType
riskLevel