{-# 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.LexV2Models.Types.BotLocaleImportSpecification
-- 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.LexV2Models.Types.BotLocaleImportSpecification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types.VoiceSettings
import qualified Amazonka.Prelude as Prelude

-- | Provides the bot locale parameters required for importing a bot locale.
--
-- /See:/ 'newBotLocaleImportSpecification' smart constructor.
data BotLocaleImportSpecification = BotLocaleImportSpecification'
  { -- | Determines the threshold where Amazon Lex will insert the
    -- @AMAZON.FallbackIntent@, @AMAZON.KendraSearchIntent@, or both when
    -- returning alternative intents. @AMAZON.FallbackIntent@ and
    -- @AMAZON.KendraSearchIntent@ are only inserted if they are configured for
    -- the bot.
    --
    -- For example, suppose a bot is configured with the confidence threshold
    -- of 0.80 and the @AMAZON.FallbackIntent@. Amazon Lex returns three
    -- alternative intents with the following confidence scores: IntentA
    -- (0.70), IntentB (0.60), IntentC (0.50). The response from the @PostText@
    -- operation would be:
    --
    -- -   @AMAZON.FallbackIntent@
    --
    -- -   @IntentA@
    --
    -- -   @IntentB@
    --
    -- -   @IntentC@
    BotLocaleImportSpecification -> Maybe Double
nluIntentConfidenceThreshold :: Prelude.Maybe Prelude.Double,
    BotLocaleImportSpecification -> Maybe VoiceSettings
voiceSettings :: Prelude.Maybe VoiceSettings,
    -- | The identifier of the bot to import the locale to.
    BotLocaleImportSpecification -> Text
botId :: Prelude.Text,
    -- | The version of the bot to import the locale to. This can only be the
    -- @DRAFT@ version of the bot.
    BotLocaleImportSpecification -> Text
botVersion :: Prelude.Text,
    -- | The identifier of the language and locale that the bot will be used in.
    -- The string must match one of the supported locales. All of the intents,
    -- slot types, and slots used in the bot must have the same locale. For
    -- more information, see
    -- <https://docs.aws.amazon.com/lexv2/latest/dg/how-languages.html Supported languages>.
    BotLocaleImportSpecification -> Text
localeId :: Prelude.Text
  }
  deriving (BotLocaleImportSpecification
-> BotLocaleImportSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BotLocaleImportSpecification
-> BotLocaleImportSpecification -> Bool
$c/= :: BotLocaleImportSpecification
-> BotLocaleImportSpecification -> Bool
== :: BotLocaleImportSpecification
-> BotLocaleImportSpecification -> Bool
$c== :: BotLocaleImportSpecification
-> BotLocaleImportSpecification -> Bool
Prelude.Eq, ReadPrec [BotLocaleImportSpecification]
ReadPrec BotLocaleImportSpecification
Int -> ReadS BotLocaleImportSpecification
ReadS [BotLocaleImportSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BotLocaleImportSpecification]
$creadListPrec :: ReadPrec [BotLocaleImportSpecification]
readPrec :: ReadPrec BotLocaleImportSpecification
$creadPrec :: ReadPrec BotLocaleImportSpecification
readList :: ReadS [BotLocaleImportSpecification]
$creadList :: ReadS [BotLocaleImportSpecification]
readsPrec :: Int -> ReadS BotLocaleImportSpecification
$creadsPrec :: Int -> ReadS BotLocaleImportSpecification
Prelude.Read, Int -> BotLocaleImportSpecification -> ShowS
[BotLocaleImportSpecification] -> ShowS
BotLocaleImportSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BotLocaleImportSpecification] -> ShowS
$cshowList :: [BotLocaleImportSpecification] -> ShowS
show :: BotLocaleImportSpecification -> String
$cshow :: BotLocaleImportSpecification -> String
showsPrec :: Int -> BotLocaleImportSpecification -> ShowS
$cshowsPrec :: Int -> BotLocaleImportSpecification -> ShowS
Prelude.Show, forall x.
Rep BotLocaleImportSpecification x -> BotLocaleImportSpecification
forall x.
BotLocaleImportSpecification -> Rep BotLocaleImportSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BotLocaleImportSpecification x -> BotLocaleImportSpecification
$cfrom :: forall x.
BotLocaleImportSpecification -> Rep BotLocaleImportSpecification x
Prelude.Generic)

-- |
-- Create a value of 'BotLocaleImportSpecification' 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:
--
-- 'nluIntentConfidenceThreshold', 'botLocaleImportSpecification_nluIntentConfidenceThreshold' - Determines the threshold where Amazon Lex will insert the
-- @AMAZON.FallbackIntent@, @AMAZON.KendraSearchIntent@, or both when
-- returning alternative intents. @AMAZON.FallbackIntent@ and
-- @AMAZON.KendraSearchIntent@ are only inserted if they are configured for
-- the bot.
--
-- For example, suppose a bot is configured with the confidence threshold
-- of 0.80 and the @AMAZON.FallbackIntent@. Amazon Lex returns three
-- alternative intents with the following confidence scores: IntentA
-- (0.70), IntentB (0.60), IntentC (0.50). The response from the @PostText@
-- operation would be:
--
-- -   @AMAZON.FallbackIntent@
--
-- -   @IntentA@
--
-- -   @IntentB@
--
-- -   @IntentC@
--
-- 'voiceSettings', 'botLocaleImportSpecification_voiceSettings' - Undocumented member.
--
-- 'botId', 'botLocaleImportSpecification_botId' - The identifier of the bot to import the locale to.
--
-- 'botVersion', 'botLocaleImportSpecification_botVersion' - The version of the bot to import the locale to. This can only be the
-- @DRAFT@ version of the bot.
--
-- 'localeId', 'botLocaleImportSpecification_localeId' - The identifier of the language and locale that the bot will be used in.
-- The string must match one of the supported locales. All of the intents,
-- slot types, and slots used in the bot must have the same locale. For
-- more information, see
-- <https://docs.aws.amazon.com/lexv2/latest/dg/how-languages.html Supported languages>.
newBotLocaleImportSpecification ::
  -- | 'botId'
  Prelude.Text ->
  -- | 'botVersion'
  Prelude.Text ->
  -- | 'localeId'
  Prelude.Text ->
  BotLocaleImportSpecification
newBotLocaleImportSpecification :: Text -> Text -> Text -> BotLocaleImportSpecification
newBotLocaleImportSpecification
  Text
pBotId_
  Text
pBotVersion_
  Text
pLocaleId_ =
    BotLocaleImportSpecification'
      { $sel:nluIntentConfidenceThreshold:BotLocaleImportSpecification' :: Maybe Double
nluIntentConfidenceThreshold =
          forall a. Maybe a
Prelude.Nothing,
        $sel:voiceSettings:BotLocaleImportSpecification' :: Maybe VoiceSettings
voiceSettings = forall a. Maybe a
Prelude.Nothing,
        $sel:botId:BotLocaleImportSpecification' :: Text
botId = Text
pBotId_,
        $sel:botVersion:BotLocaleImportSpecification' :: Text
botVersion = Text
pBotVersion_,
        $sel:localeId:BotLocaleImportSpecification' :: Text
localeId = Text
pLocaleId_
      }

-- | Determines the threshold where Amazon Lex will insert the
-- @AMAZON.FallbackIntent@, @AMAZON.KendraSearchIntent@, or both when
-- returning alternative intents. @AMAZON.FallbackIntent@ and
-- @AMAZON.KendraSearchIntent@ are only inserted if they are configured for
-- the bot.
--
-- For example, suppose a bot is configured with the confidence threshold
-- of 0.80 and the @AMAZON.FallbackIntent@. Amazon Lex returns three
-- alternative intents with the following confidence scores: IntentA
-- (0.70), IntentB (0.60), IntentC (0.50). The response from the @PostText@
-- operation would be:
--
-- -   @AMAZON.FallbackIntent@
--
-- -   @IntentA@
--
-- -   @IntentB@
--
-- -   @IntentC@
botLocaleImportSpecification_nluIntentConfidenceThreshold :: Lens.Lens' BotLocaleImportSpecification (Prelude.Maybe Prelude.Double)
botLocaleImportSpecification_nluIntentConfidenceThreshold :: Lens' BotLocaleImportSpecification (Maybe Double)
botLocaleImportSpecification_nluIntentConfidenceThreshold = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotLocaleImportSpecification' {Maybe Double
nluIntentConfidenceThreshold :: Maybe Double
$sel:nluIntentConfidenceThreshold:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Maybe Double
nluIntentConfidenceThreshold} -> Maybe Double
nluIntentConfidenceThreshold) (\s :: BotLocaleImportSpecification
s@BotLocaleImportSpecification' {} Maybe Double
a -> BotLocaleImportSpecification
s {$sel:nluIntentConfidenceThreshold:BotLocaleImportSpecification' :: Maybe Double
nluIntentConfidenceThreshold = Maybe Double
a} :: BotLocaleImportSpecification)

-- | Undocumented member.
botLocaleImportSpecification_voiceSettings :: Lens.Lens' BotLocaleImportSpecification (Prelude.Maybe VoiceSettings)
botLocaleImportSpecification_voiceSettings :: Lens' BotLocaleImportSpecification (Maybe VoiceSettings)
botLocaleImportSpecification_voiceSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotLocaleImportSpecification' {Maybe VoiceSettings
voiceSettings :: Maybe VoiceSettings
$sel:voiceSettings:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Maybe VoiceSettings
voiceSettings} -> Maybe VoiceSettings
voiceSettings) (\s :: BotLocaleImportSpecification
s@BotLocaleImportSpecification' {} Maybe VoiceSettings
a -> BotLocaleImportSpecification
s {$sel:voiceSettings:BotLocaleImportSpecification' :: Maybe VoiceSettings
voiceSettings = Maybe VoiceSettings
a} :: BotLocaleImportSpecification)

-- | The identifier of the bot to import the locale to.
botLocaleImportSpecification_botId :: Lens.Lens' BotLocaleImportSpecification Prelude.Text
botLocaleImportSpecification_botId :: Lens' BotLocaleImportSpecification Text
botLocaleImportSpecification_botId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotLocaleImportSpecification' {Text
botId :: Text
$sel:botId:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
botId} -> Text
botId) (\s :: BotLocaleImportSpecification
s@BotLocaleImportSpecification' {} Text
a -> BotLocaleImportSpecification
s {$sel:botId:BotLocaleImportSpecification' :: Text
botId = Text
a} :: BotLocaleImportSpecification)

-- | The version of the bot to import the locale to. This can only be the
-- @DRAFT@ version of the bot.
botLocaleImportSpecification_botVersion :: Lens.Lens' BotLocaleImportSpecification Prelude.Text
botLocaleImportSpecification_botVersion :: Lens' BotLocaleImportSpecification Text
botLocaleImportSpecification_botVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotLocaleImportSpecification' {Text
botVersion :: Text
$sel:botVersion:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
botVersion} -> Text
botVersion) (\s :: BotLocaleImportSpecification
s@BotLocaleImportSpecification' {} Text
a -> BotLocaleImportSpecification
s {$sel:botVersion:BotLocaleImportSpecification' :: Text
botVersion = Text
a} :: BotLocaleImportSpecification)

-- | The identifier of the language and locale that the bot will be used in.
-- The string must match one of the supported locales. All of the intents,
-- slot types, and slots used in the bot must have the same locale. For
-- more information, see
-- <https://docs.aws.amazon.com/lexv2/latest/dg/how-languages.html Supported languages>.
botLocaleImportSpecification_localeId :: Lens.Lens' BotLocaleImportSpecification Prelude.Text
botLocaleImportSpecification_localeId :: Lens' BotLocaleImportSpecification Text
botLocaleImportSpecification_localeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotLocaleImportSpecification' {Text
localeId :: Text
$sel:localeId:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
localeId} -> Text
localeId) (\s :: BotLocaleImportSpecification
s@BotLocaleImportSpecification' {} Text
a -> BotLocaleImportSpecification
s {$sel:localeId:BotLocaleImportSpecification' :: Text
localeId = Text
a} :: BotLocaleImportSpecification)

instance Data.FromJSON BotLocaleImportSpecification where
  parseJSON :: Value -> Parser BotLocaleImportSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BotLocaleImportSpecification"
      ( \Object
x ->
          Maybe Double
-> Maybe VoiceSettings
-> Text
-> Text
-> Text
-> BotLocaleImportSpecification
BotLocaleImportSpecification'
            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
"nluIntentConfidenceThreshold")
            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
"voiceSettings")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"botId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"botVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"localeId")
      )

instance
  Prelude.Hashable
    BotLocaleImportSpecification
  where
  hashWithSalt :: Int -> BotLocaleImportSpecification -> Int
hashWithSalt Int
_salt BotLocaleImportSpecification' {Maybe Double
Maybe VoiceSettings
Text
localeId :: Text
botVersion :: Text
botId :: Text
voiceSettings :: Maybe VoiceSettings
nluIntentConfidenceThreshold :: Maybe Double
$sel:localeId:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
$sel:botVersion:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
$sel:botId:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
$sel:voiceSettings:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Maybe VoiceSettings
$sel:nluIntentConfidenceThreshold:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
nluIntentConfidenceThreshold
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VoiceSettings
voiceSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
botId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
botVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
localeId

instance Prelude.NFData BotLocaleImportSpecification where
  rnf :: BotLocaleImportSpecification -> ()
rnf BotLocaleImportSpecification' {Maybe Double
Maybe VoiceSettings
Text
localeId :: Text
botVersion :: Text
botId :: Text
voiceSettings :: Maybe VoiceSettings
nluIntentConfidenceThreshold :: Maybe Double
$sel:localeId:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
$sel:botVersion:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
$sel:botId:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
$sel:voiceSettings:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Maybe VoiceSettings
$sel:nluIntentConfidenceThreshold:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
nluIntentConfidenceThreshold
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VoiceSettings
voiceSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
botId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
botVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
localeId

instance Data.ToJSON BotLocaleImportSpecification where
  toJSON :: BotLocaleImportSpecification -> Value
toJSON BotLocaleImportSpecification' {Maybe Double
Maybe VoiceSettings
Text
localeId :: Text
botVersion :: Text
botId :: Text
voiceSettings :: Maybe VoiceSettings
nluIntentConfidenceThreshold :: Maybe Double
$sel:localeId:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
$sel:botVersion:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
$sel:botId:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Text
$sel:voiceSettings:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Maybe VoiceSettings
$sel:nluIntentConfidenceThreshold:BotLocaleImportSpecification' :: BotLocaleImportSpecification -> Maybe Double
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"nluIntentConfidenceThreshold" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
nluIntentConfidenceThreshold,
            (Key
"voiceSettings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VoiceSettings
voiceSettings,
            forall a. a -> Maybe a
Prelude.Just (Key
"botId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
botId),
            forall a. a -> Maybe a
Prelude.Just (Key
"botVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
botVersion),
            forall a. a -> Maybe a
Prelude.Just (Key
"localeId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
localeId)
          ]
      )