{-# 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.NewCustomVocabularyItem
-- 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.NewCustomVocabularyItem 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

-- | The new custom vocabulary item from the custom vocabulary list.
--
-- /See:/ 'newNewCustomVocabularyItem' smart constructor.
data NewCustomVocabularyItem = NewCustomVocabularyItem'
  { -- | The display as value assigned to the new custom vocabulary item from the
    -- custom vocabulary list.
    NewCustomVocabularyItem -> Maybe Text
displayAs :: Prelude.Maybe Prelude.Text,
    -- | The weight assigned to the new custom vocabulary item from the custom
    -- vocabulary list.
    NewCustomVocabularyItem -> Maybe Natural
weight :: Prelude.Maybe Prelude.Natural,
    -- | The unique phrase for the new custom vocabulary item from the custom
    -- vocabulary list.
    NewCustomVocabularyItem -> Text
phrase :: Prelude.Text
  }
  deriving (NewCustomVocabularyItem -> NewCustomVocabularyItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NewCustomVocabularyItem -> NewCustomVocabularyItem -> Bool
$c/= :: NewCustomVocabularyItem -> NewCustomVocabularyItem -> Bool
== :: NewCustomVocabularyItem -> NewCustomVocabularyItem -> Bool
$c== :: NewCustomVocabularyItem -> NewCustomVocabularyItem -> Bool
Prelude.Eq, ReadPrec [NewCustomVocabularyItem]
ReadPrec NewCustomVocabularyItem
Int -> ReadS NewCustomVocabularyItem
ReadS [NewCustomVocabularyItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NewCustomVocabularyItem]
$creadListPrec :: ReadPrec [NewCustomVocabularyItem]
readPrec :: ReadPrec NewCustomVocabularyItem
$creadPrec :: ReadPrec NewCustomVocabularyItem
readList :: ReadS [NewCustomVocabularyItem]
$creadList :: ReadS [NewCustomVocabularyItem]
readsPrec :: Int -> ReadS NewCustomVocabularyItem
$creadsPrec :: Int -> ReadS NewCustomVocabularyItem
Prelude.Read, Int -> NewCustomVocabularyItem -> ShowS
[NewCustomVocabularyItem] -> ShowS
NewCustomVocabularyItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NewCustomVocabularyItem] -> ShowS
$cshowList :: [NewCustomVocabularyItem] -> ShowS
show :: NewCustomVocabularyItem -> String
$cshow :: NewCustomVocabularyItem -> String
showsPrec :: Int -> NewCustomVocabularyItem -> ShowS
$cshowsPrec :: Int -> NewCustomVocabularyItem -> ShowS
Prelude.Show, forall x. Rep NewCustomVocabularyItem x -> NewCustomVocabularyItem
forall x. NewCustomVocabularyItem -> Rep NewCustomVocabularyItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NewCustomVocabularyItem x -> NewCustomVocabularyItem
$cfrom :: forall x. NewCustomVocabularyItem -> Rep NewCustomVocabularyItem x
Prelude.Generic)

-- |
-- Create a value of 'NewCustomVocabularyItem' 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:
--
-- 'displayAs', 'newCustomVocabularyItem_displayAs' - The display as value assigned to the new custom vocabulary item from the
-- custom vocabulary list.
--
-- 'weight', 'newCustomVocabularyItem_weight' - The weight assigned to the new custom vocabulary item from the custom
-- vocabulary list.
--
-- 'phrase', 'newCustomVocabularyItem_phrase' - The unique phrase for the new custom vocabulary item from the custom
-- vocabulary list.
newNewCustomVocabularyItem ::
  -- | 'phrase'
  Prelude.Text ->
  NewCustomVocabularyItem
newNewCustomVocabularyItem :: Text -> NewCustomVocabularyItem
newNewCustomVocabularyItem Text
pPhrase_ =
  NewCustomVocabularyItem'
    { $sel:displayAs:NewCustomVocabularyItem' :: Maybe Text
displayAs =
        forall a. Maybe a
Prelude.Nothing,
      $sel:weight:NewCustomVocabularyItem' :: Maybe Natural
weight = forall a. Maybe a
Prelude.Nothing,
      $sel:phrase:NewCustomVocabularyItem' :: Text
phrase = Text
pPhrase_
    }

-- | The display as value assigned to the new custom vocabulary item from the
-- custom vocabulary list.
newCustomVocabularyItem_displayAs :: Lens.Lens' NewCustomVocabularyItem (Prelude.Maybe Prelude.Text)
newCustomVocabularyItem_displayAs :: Lens' NewCustomVocabularyItem (Maybe Text)
newCustomVocabularyItem_displayAs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NewCustomVocabularyItem' {Maybe Text
displayAs :: Maybe Text
$sel:displayAs:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Maybe Text
displayAs} -> Maybe Text
displayAs) (\s :: NewCustomVocabularyItem
s@NewCustomVocabularyItem' {} Maybe Text
a -> NewCustomVocabularyItem
s {$sel:displayAs:NewCustomVocabularyItem' :: Maybe Text
displayAs = Maybe Text
a} :: NewCustomVocabularyItem)

-- | The weight assigned to the new custom vocabulary item from the custom
-- vocabulary list.
newCustomVocabularyItem_weight :: Lens.Lens' NewCustomVocabularyItem (Prelude.Maybe Prelude.Natural)
newCustomVocabularyItem_weight :: Lens' NewCustomVocabularyItem (Maybe Natural)
newCustomVocabularyItem_weight = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NewCustomVocabularyItem' {Maybe Natural
weight :: Maybe Natural
$sel:weight:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Maybe Natural
weight} -> Maybe Natural
weight) (\s :: NewCustomVocabularyItem
s@NewCustomVocabularyItem' {} Maybe Natural
a -> NewCustomVocabularyItem
s {$sel:weight:NewCustomVocabularyItem' :: Maybe Natural
weight = Maybe Natural
a} :: NewCustomVocabularyItem)

-- | The unique phrase for the new custom vocabulary item from the custom
-- vocabulary list.
newCustomVocabularyItem_phrase :: Lens.Lens' NewCustomVocabularyItem Prelude.Text
newCustomVocabularyItem_phrase :: Lens' NewCustomVocabularyItem Text
newCustomVocabularyItem_phrase = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NewCustomVocabularyItem' {Text
phrase :: Text
$sel:phrase:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Text
phrase} -> Text
phrase) (\s :: NewCustomVocabularyItem
s@NewCustomVocabularyItem' {} Text
a -> NewCustomVocabularyItem
s {$sel:phrase:NewCustomVocabularyItem' :: Text
phrase = Text
a} :: NewCustomVocabularyItem)

instance Prelude.Hashable NewCustomVocabularyItem where
  hashWithSalt :: Int -> NewCustomVocabularyItem -> Int
hashWithSalt Int
_salt NewCustomVocabularyItem' {Maybe Natural
Maybe Text
Text
phrase :: Text
weight :: Maybe Natural
displayAs :: Maybe Text
$sel:phrase:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Text
$sel:weight:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Maybe Natural
$sel:displayAs:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
displayAs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
weight
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
phrase

instance Prelude.NFData NewCustomVocabularyItem where
  rnf :: NewCustomVocabularyItem -> ()
rnf NewCustomVocabularyItem' {Maybe Natural
Maybe Text
Text
phrase :: Text
weight :: Maybe Natural
displayAs :: Maybe Text
$sel:phrase:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Text
$sel:weight:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Maybe Natural
$sel:displayAs:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
displayAs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
weight
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
phrase

instance Data.ToJSON NewCustomVocabularyItem where
  toJSON :: NewCustomVocabularyItem -> Value
toJSON NewCustomVocabularyItem' {Maybe Natural
Maybe Text
Text
phrase :: Text
weight :: Maybe Natural
displayAs :: Maybe Text
$sel:phrase:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Text
$sel:weight:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Maybe Natural
$sel:displayAs:NewCustomVocabularyItem' :: NewCustomVocabularyItem -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"displayAs" 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
displayAs,
            (Key
"weight" 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 Natural
weight,
            forall a. a -> Maybe a
Prelude.Just (Key
"phrase" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
phrase)
          ]
      )