{-# 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.SuggestionValue
-- 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.SuggestionValue where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kendra.Types.SuggestionTextWithHighlights
import qualified Amazonka.Prelude as Prelude

-- | The @SuggestionTextWithHighlights@ structure information.
--
-- /See:/ 'newSuggestionValue' smart constructor.
data SuggestionValue = SuggestionValue'
  { -- | The @SuggestionTextWithHighlights@ structure that contains the query
    -- suggestion text and highlights.
    SuggestionValue -> Maybe SuggestionTextWithHighlights
text :: Prelude.Maybe SuggestionTextWithHighlights
  }
  deriving (SuggestionValue -> SuggestionValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuggestionValue -> SuggestionValue -> Bool
$c/= :: SuggestionValue -> SuggestionValue -> Bool
== :: SuggestionValue -> SuggestionValue -> Bool
$c== :: SuggestionValue -> SuggestionValue -> Bool
Prelude.Eq, ReadPrec [SuggestionValue]
ReadPrec SuggestionValue
Int -> ReadS SuggestionValue
ReadS [SuggestionValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuggestionValue]
$creadListPrec :: ReadPrec [SuggestionValue]
readPrec :: ReadPrec SuggestionValue
$creadPrec :: ReadPrec SuggestionValue
readList :: ReadS [SuggestionValue]
$creadList :: ReadS [SuggestionValue]
readsPrec :: Int -> ReadS SuggestionValue
$creadsPrec :: Int -> ReadS SuggestionValue
Prelude.Read, Int -> SuggestionValue -> ShowS
[SuggestionValue] -> ShowS
SuggestionValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuggestionValue] -> ShowS
$cshowList :: [SuggestionValue] -> ShowS
show :: SuggestionValue -> String
$cshow :: SuggestionValue -> String
showsPrec :: Int -> SuggestionValue -> ShowS
$cshowsPrec :: Int -> SuggestionValue -> ShowS
Prelude.Show, forall x. Rep SuggestionValue x -> SuggestionValue
forall x. SuggestionValue -> Rep SuggestionValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SuggestionValue x -> SuggestionValue
$cfrom :: forall x. SuggestionValue -> Rep SuggestionValue x
Prelude.Generic)

-- |
-- Create a value of 'SuggestionValue' 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:
--
-- 'text', 'suggestionValue_text' - The @SuggestionTextWithHighlights@ structure that contains the query
-- suggestion text and highlights.
newSuggestionValue ::
  SuggestionValue
newSuggestionValue :: SuggestionValue
newSuggestionValue =
  SuggestionValue' {$sel:text:SuggestionValue' :: Maybe SuggestionTextWithHighlights
text = forall a. Maybe a
Prelude.Nothing}

-- | The @SuggestionTextWithHighlights@ structure that contains the query
-- suggestion text and highlights.
suggestionValue_text :: Lens.Lens' SuggestionValue (Prelude.Maybe SuggestionTextWithHighlights)
suggestionValue_text :: Lens' SuggestionValue (Maybe SuggestionTextWithHighlights)
suggestionValue_text = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuggestionValue' {Maybe SuggestionTextWithHighlights
text :: Maybe SuggestionTextWithHighlights
$sel:text:SuggestionValue' :: SuggestionValue -> Maybe SuggestionTextWithHighlights
text} -> Maybe SuggestionTextWithHighlights
text) (\s :: SuggestionValue
s@SuggestionValue' {} Maybe SuggestionTextWithHighlights
a -> SuggestionValue
s {$sel:text:SuggestionValue' :: Maybe SuggestionTextWithHighlights
text = Maybe SuggestionTextWithHighlights
a} :: SuggestionValue)

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

instance Prelude.Hashable SuggestionValue where
  hashWithSalt :: Int -> SuggestionValue -> Int
hashWithSalt Int
_salt SuggestionValue' {Maybe SuggestionTextWithHighlights
text :: Maybe SuggestionTextWithHighlights
$sel:text:SuggestionValue' :: SuggestionValue -> Maybe SuggestionTextWithHighlights
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SuggestionTextWithHighlights
text

instance Prelude.NFData SuggestionValue where
  rnf :: SuggestionValue -> ()
rnf SuggestionValue' {Maybe SuggestionTextWithHighlights
text :: Maybe SuggestionTextWithHighlights
$sel:text:SuggestionValue' :: SuggestionValue -> Maybe SuggestionTextWithHighlights
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe SuggestionTextWithHighlights
text