{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.LexRuntime.Types.IntentConfidence 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

-- | 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
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]
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
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. 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' {$sel:score:IntentConfidence' :: Maybe Double
score = 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 :: Lens' IntentConfidence (Maybe Double)
intentConfidence_score = 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 Data.FromJSON IntentConfidence where
  parseJSON :: Value -> Parser IntentConfidence
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IntentConfidence"
      ( \Object
x ->
          Maybe Double -> IntentConfidence
IntentConfidence' 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
"score")
      )

instance Prelude.Hashable IntentConfidence where
  hashWithSalt :: Int -> IntentConfidence -> Int
hashWithSalt Int
_salt IntentConfidence' {Maybe Double
score :: Maybe Double
$sel:score:IntentConfidence' :: IntentConfidence -> Maybe Double
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
score

instance Prelude.NFData IntentConfidence where
  rnf :: IntentConfidence -> ()
rnf IntentConfidence' {Maybe Double
score :: Maybe Double
$sel:score:IntentConfidence' :: IntentConfidence -> Maybe Double
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
score