{-# 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.LexRuntime.Types.IntentConfidence
-- 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.LexRuntime.Types.IntentConfidence where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides a score that indicates the confidence that Amazon Lex has that
-- an intent is the one that satisfies the user\'s intent.
--
-- /See:/ 'newIntentConfidence' smart constructor.
data IntentConfidence = IntentConfidence'
  { -- | A score that indicates how confident Amazon Lex is that an intent
    -- satisfies the user\'s intent. Ranges between 0.00 and 1.00. Higher
    -- scores indicate higher confidence.
    IntentConfidence -> Maybe Double
score :: Prelude.Maybe Prelude.Double
  }
  deriving (IntentConfidence -> IntentConfidence -> Bool
(IntentConfidence -> IntentConfidence -> Bool)
-> (IntentConfidence -> IntentConfidence -> Bool)
-> Eq IntentConfidence
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntentConfidence -> IntentConfidence -> Bool
$c/= :: IntentConfidence -> IntentConfidence -> Bool
== :: IntentConfidence -> IntentConfidence -> Bool
$c== :: IntentConfidence -> IntentConfidence -> Bool
Prelude.Eq, ReadPrec [IntentConfidence]
ReadPrec IntentConfidence
Int -> ReadS IntentConfidence
ReadS [IntentConfidence]
(Int -> ReadS IntentConfidence)
-> ReadS [IntentConfidence]
-> ReadPrec IntentConfidence
-> ReadPrec [IntentConfidence]
-> Read IntentConfidence
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IntentConfidence]
$creadListPrec :: ReadPrec [IntentConfidence]
readPrec :: ReadPrec IntentConfidence
$creadPrec :: ReadPrec IntentConfidence
readList :: ReadS [IntentConfidence]
$creadList :: ReadS [IntentConfidence]
readsPrec :: Int -> ReadS IntentConfidence
$creadsPrec :: Int -> ReadS IntentConfidence
Prelude.Read, Int -> IntentConfidence -> ShowS
[IntentConfidence] -> ShowS
IntentConfidence -> String
(Int -> IntentConfidence -> ShowS)
-> (IntentConfidence -> String)
-> ([IntentConfidence] -> ShowS)
-> Show IntentConfidence
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntentConfidence] -> ShowS
$cshowList :: [IntentConfidence] -> ShowS
show :: IntentConfidence -> String
$cshow :: IntentConfidence -> String
showsPrec :: Int -> IntentConfidence -> ShowS
$cshowsPrec :: Int -> IntentConfidence -> ShowS
Prelude.Show, (forall x. IntentConfidence -> Rep IntentConfidence x)
-> (forall x. Rep IntentConfidence x -> IntentConfidence)
-> Generic IntentConfidence
forall x. Rep IntentConfidence x -> IntentConfidence
forall x. IntentConfidence -> Rep IntentConfidence x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IntentConfidence x -> IntentConfidence
$cfrom :: forall x. IntentConfidence -> Rep IntentConfidence x
Prelude.Generic)

-- |
-- Create a value of 'IntentConfidence' 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:
--
-- 'score', 'intentConfidence_score' - A score that indicates how confident Amazon Lex is that an intent
-- satisfies the user\'s intent. Ranges between 0.00 and 1.00. Higher
-- scores indicate higher confidence.
newIntentConfidence ::
  IntentConfidence
newIntentConfidence :: IntentConfidence
newIntentConfidence =
  IntentConfidence' :: Maybe Double -> IntentConfidence
IntentConfidence' {$sel:score:IntentConfidence' :: Maybe Double
score = Maybe Double
forall a. Maybe a
Prelude.Nothing}

-- | A score that indicates how confident Amazon Lex is that an intent
-- satisfies the user\'s intent. Ranges between 0.00 and 1.00. Higher
-- scores indicate higher confidence.
intentConfidence_score :: Lens.Lens' IntentConfidence (Prelude.Maybe Prelude.Double)
intentConfidence_score :: (Maybe Double -> f (Maybe Double))
-> IntentConfidence -> f IntentConfidence
intentConfidence_score = (IntentConfidence -> Maybe Double)
-> (IntentConfidence -> Maybe Double -> IntentConfidence)
-> Lens
     IntentConfidence IntentConfidence (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntentConfidence' {Maybe Double
score :: Maybe Double
$sel:score:IntentConfidence' :: IntentConfidence -> Maybe Double
score} -> Maybe Double
score) (\s :: IntentConfidence
s@IntentConfidence' {} Maybe Double
a -> IntentConfidence
s {$sel:score:IntentConfidence' :: Maybe Double
score = Maybe Double
a} :: IntentConfidence)

instance Core.FromJSON IntentConfidence where
  parseJSON :: Value -> Parser IntentConfidence
parseJSON =
    String
-> (Object -> Parser IntentConfidence)
-> Value
-> Parser IntentConfidence
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IntentConfidence"
      ( \Object
x ->
          Maybe Double -> IntentConfidence
IntentConfidence' (Maybe Double -> IntentConfidence)
-> Parser (Maybe Double) -> Parser IntentConfidence
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"score")
      )

instance Prelude.Hashable IntentConfidence

instance Prelude.NFData IntentConfidence