{-# 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.Transcribe.Types.ModelSettings
-- 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.Transcribe.Types.ModelSettings 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 the name of the custom language model that was included in the
-- specified transcription job.
--
-- Only use @ModelSettings@ with the @LanguageModelName@ sub-parameter if
-- you\'re __not__ using automatic language identification (). If using
-- @LanguageIdSettings@ in your request, this parameter contains a
-- @LanguageModelName@ sub-parameter.
--
-- /See:/ 'newModelSettings' smart constructor.
data ModelSettings = ModelSettings'
  { -- | The name of the custom language model you want to use when processing
    -- your transcription job. Note that custom language model names are case
    -- sensitive.
    --
    -- The language of the specified custom language model must match the
    -- language code that you specify in your transcription request. If the
    -- languages don\'t match, the custom language model isn\'t applied. There
    -- are no errors or warnings associated with a language mismatch.
    ModelSettings -> Maybe Text
languageModelName :: Prelude.Maybe Prelude.Text
  }
  deriving (ModelSettings -> ModelSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelSettings -> ModelSettings -> Bool
$c/= :: ModelSettings -> ModelSettings -> Bool
== :: ModelSettings -> ModelSettings -> Bool
$c== :: ModelSettings -> ModelSettings -> Bool
Prelude.Eq, ReadPrec [ModelSettings]
ReadPrec ModelSettings
Int -> ReadS ModelSettings
ReadS [ModelSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelSettings]
$creadListPrec :: ReadPrec [ModelSettings]
readPrec :: ReadPrec ModelSettings
$creadPrec :: ReadPrec ModelSettings
readList :: ReadS [ModelSettings]
$creadList :: ReadS [ModelSettings]
readsPrec :: Int -> ReadS ModelSettings
$creadsPrec :: Int -> ReadS ModelSettings
Prelude.Read, Int -> ModelSettings -> ShowS
[ModelSettings] -> ShowS
ModelSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelSettings] -> ShowS
$cshowList :: [ModelSettings] -> ShowS
show :: ModelSettings -> String
$cshow :: ModelSettings -> String
showsPrec :: Int -> ModelSettings -> ShowS
$cshowsPrec :: Int -> ModelSettings -> ShowS
Prelude.Show, forall x. Rep ModelSettings x -> ModelSettings
forall x. ModelSettings -> Rep ModelSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModelSettings x -> ModelSettings
$cfrom :: forall x. ModelSettings -> Rep ModelSettings x
Prelude.Generic)

-- |
-- Create a value of 'ModelSettings' 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:
--
-- 'languageModelName', 'modelSettings_languageModelName' - The name of the custom language model you want to use when processing
-- your transcription job. Note that custom language model names are case
-- sensitive.
--
-- The language of the specified custom language model must match the
-- language code that you specify in your transcription request. If the
-- languages don\'t match, the custom language model isn\'t applied. There
-- are no errors or warnings associated with a language mismatch.
newModelSettings ::
  ModelSettings
newModelSettings :: ModelSettings
newModelSettings =
  ModelSettings' {$sel:languageModelName:ModelSettings' :: Maybe Text
languageModelName = forall a. Maybe a
Prelude.Nothing}

-- | The name of the custom language model you want to use when processing
-- your transcription job. Note that custom language model names are case
-- sensitive.
--
-- The language of the specified custom language model must match the
-- language code that you specify in your transcription request. If the
-- languages don\'t match, the custom language model isn\'t applied. There
-- are no errors or warnings associated with a language mismatch.
modelSettings_languageModelName :: Lens.Lens' ModelSettings (Prelude.Maybe Prelude.Text)
modelSettings_languageModelName :: Lens' ModelSettings (Maybe Text)
modelSettings_languageModelName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelSettings' {Maybe Text
languageModelName :: Maybe Text
$sel:languageModelName:ModelSettings' :: ModelSettings -> Maybe Text
languageModelName} -> Maybe Text
languageModelName) (\s :: ModelSettings
s@ModelSettings' {} Maybe Text
a -> ModelSettings
s {$sel:languageModelName:ModelSettings' :: Maybe Text
languageModelName = Maybe Text
a} :: ModelSettings)

instance Data.FromJSON ModelSettings where
  parseJSON :: Value -> Parser ModelSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ModelSettings"
      ( \Object
x ->
          Maybe Text -> ModelSettings
ModelSettings'
            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
"LanguageModelName")
      )

instance Prelude.Hashable ModelSettings where
  hashWithSalt :: Int -> ModelSettings -> Int
hashWithSalt Int
_salt ModelSettings' {Maybe Text
languageModelName :: Maybe Text
$sel:languageModelName:ModelSettings' :: ModelSettings -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
languageModelName

instance Prelude.NFData ModelSettings where
  rnf :: ModelSettings -> ()
rnf ModelSettings' {Maybe Text
languageModelName :: Maybe Text
$sel:languageModelName:ModelSettings' :: ModelSettings -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
languageModelName

instance Data.ToJSON ModelSettings where
  toJSON :: ModelSettings -> Value
toJSON ModelSettings' {Maybe Text
languageModelName :: Maybe Text
$sel:languageModelName:ModelSettings' :: ModelSettings -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"LanguageModelName" 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 Text
languageModelName
          ]
      )