{-# 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.Kendra.Types.SpellCorrectionConfiguration
-- 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.Kendra.Types.SpellCorrectionConfiguration 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 configuration information for suggested query spell
-- corrections.
--
-- Suggested spell corrections are based on words that appear in your
-- indexed documents and how closely a corrected word matches a misspelled
-- word.
--
-- This feature is designed with certain defaults or limits. For
-- information on the current limits and how to request more support for
-- some limits, see the
-- <https://docs.aws.amazon.com/kendra/latest/dg/query-spell-check.html Spell Checker documentation>.
--
-- /See:/ 'newSpellCorrectionConfiguration' smart constructor.
data SpellCorrectionConfiguration = SpellCorrectionConfiguration'
  { -- | @TRUE@ to suggest spell corrections for queries.
    SpellCorrectionConfiguration -> Bool
includeQuerySpellCheckSuggestions :: Prelude.Bool
  }
  deriving (SpellCorrectionConfiguration
-> SpellCorrectionConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SpellCorrectionConfiguration
-> SpellCorrectionConfiguration -> Bool
$c/= :: SpellCorrectionConfiguration
-> SpellCorrectionConfiguration -> Bool
== :: SpellCorrectionConfiguration
-> SpellCorrectionConfiguration -> Bool
$c== :: SpellCorrectionConfiguration
-> SpellCorrectionConfiguration -> Bool
Prelude.Eq, ReadPrec [SpellCorrectionConfiguration]
ReadPrec SpellCorrectionConfiguration
Int -> ReadS SpellCorrectionConfiguration
ReadS [SpellCorrectionConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SpellCorrectionConfiguration]
$creadListPrec :: ReadPrec [SpellCorrectionConfiguration]
readPrec :: ReadPrec SpellCorrectionConfiguration
$creadPrec :: ReadPrec SpellCorrectionConfiguration
readList :: ReadS [SpellCorrectionConfiguration]
$creadList :: ReadS [SpellCorrectionConfiguration]
readsPrec :: Int -> ReadS SpellCorrectionConfiguration
$creadsPrec :: Int -> ReadS SpellCorrectionConfiguration
Prelude.Read, Int -> SpellCorrectionConfiguration -> ShowS
[SpellCorrectionConfiguration] -> ShowS
SpellCorrectionConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SpellCorrectionConfiguration] -> ShowS
$cshowList :: [SpellCorrectionConfiguration] -> ShowS
show :: SpellCorrectionConfiguration -> String
$cshow :: SpellCorrectionConfiguration -> String
showsPrec :: Int -> SpellCorrectionConfiguration -> ShowS
$cshowsPrec :: Int -> SpellCorrectionConfiguration -> ShowS
Prelude.Show, forall x.
Rep SpellCorrectionConfiguration x -> SpellCorrectionConfiguration
forall x.
SpellCorrectionConfiguration -> Rep SpellCorrectionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SpellCorrectionConfiguration x -> SpellCorrectionConfiguration
$cfrom :: forall x.
SpellCorrectionConfiguration -> Rep SpellCorrectionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SpellCorrectionConfiguration' 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:
--
-- 'includeQuerySpellCheckSuggestions', 'spellCorrectionConfiguration_includeQuerySpellCheckSuggestions' - @TRUE@ to suggest spell corrections for queries.
newSpellCorrectionConfiguration ::
  -- | 'includeQuerySpellCheckSuggestions'
  Prelude.Bool ->
  SpellCorrectionConfiguration
newSpellCorrectionConfiguration :: Bool -> SpellCorrectionConfiguration
newSpellCorrectionConfiguration
  Bool
pIncludeQuerySpellCheckSuggestions_ =
    SpellCorrectionConfiguration'
      { $sel:includeQuerySpellCheckSuggestions:SpellCorrectionConfiguration' :: Bool
includeQuerySpellCheckSuggestions =
          Bool
pIncludeQuerySpellCheckSuggestions_
      }

-- | @TRUE@ to suggest spell corrections for queries.
spellCorrectionConfiguration_includeQuerySpellCheckSuggestions :: Lens.Lens' SpellCorrectionConfiguration Prelude.Bool
spellCorrectionConfiguration_includeQuerySpellCheckSuggestions :: Lens' SpellCorrectionConfiguration Bool
spellCorrectionConfiguration_includeQuerySpellCheckSuggestions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpellCorrectionConfiguration' {Bool
includeQuerySpellCheckSuggestions :: Bool
$sel:includeQuerySpellCheckSuggestions:SpellCorrectionConfiguration' :: SpellCorrectionConfiguration -> Bool
includeQuerySpellCheckSuggestions} -> Bool
includeQuerySpellCheckSuggestions) (\s :: SpellCorrectionConfiguration
s@SpellCorrectionConfiguration' {} Bool
a -> SpellCorrectionConfiguration
s {$sel:includeQuerySpellCheckSuggestions:SpellCorrectionConfiguration' :: Bool
includeQuerySpellCheckSuggestions = Bool
a} :: SpellCorrectionConfiguration)

instance
  Prelude.Hashable
    SpellCorrectionConfiguration
  where
  hashWithSalt :: Int -> SpellCorrectionConfiguration -> Int
hashWithSalt Int
_salt SpellCorrectionConfiguration' {Bool
includeQuerySpellCheckSuggestions :: Bool
$sel:includeQuerySpellCheckSuggestions:SpellCorrectionConfiguration' :: SpellCorrectionConfiguration -> Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
includeQuerySpellCheckSuggestions

instance Prelude.NFData SpellCorrectionConfiguration where
  rnf :: SpellCorrectionConfiguration -> ()
rnf SpellCorrectionConfiguration' {Bool
includeQuerySpellCheckSuggestions :: Bool
$sel:includeQuerySpellCheckSuggestions:SpellCorrectionConfiguration' :: SpellCorrectionConfiguration -> Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Bool
includeQuerySpellCheckSuggestions

instance Data.ToJSON SpellCorrectionConfiguration where
  toJSON :: SpellCorrectionConfiguration -> Value
toJSON SpellCorrectionConfiguration' {Bool
includeQuerySpellCheckSuggestions :: Bool
$sel:includeQuerySpellCheckSuggestions:SpellCorrectionConfiguration' :: SpellCorrectionConfiguration -> Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"IncludeQuerySpellCheckSuggestions"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
includeQuerySpellCheckSuggestions
              )
          ]
      )