{-# 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.Comprehend.Types.EntityTypesListItem
-- 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.Comprehend.Types.EntityTypesListItem 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

-- | An entity type within a labeled training dataset that Amazon Comprehend
-- uses to train a custom entity recognizer.
--
-- /See:/ 'newEntityTypesListItem' smart constructor.
data EntityTypesListItem = EntityTypesListItem'
  { -- | An entity type within a labeled training dataset that Amazon Comprehend
    -- uses to train a custom entity recognizer.
    --
    -- Entity types must not contain the following invalid characters: \\n
    -- (line break), \\\\n (escaped line break, \\r (carriage return), \\\\r
    -- (escaped carriage return), \\t (tab), \\\\t (escaped tab), space, and ,
    -- (comma).
    EntityTypesListItem -> Text
type' :: Prelude.Text
  }
  deriving (EntityTypesListItem -> EntityTypesListItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EntityTypesListItem -> EntityTypesListItem -> Bool
$c/= :: EntityTypesListItem -> EntityTypesListItem -> Bool
== :: EntityTypesListItem -> EntityTypesListItem -> Bool
$c== :: EntityTypesListItem -> EntityTypesListItem -> Bool
Prelude.Eq, ReadPrec [EntityTypesListItem]
ReadPrec EntityTypesListItem
Int -> ReadS EntityTypesListItem
ReadS [EntityTypesListItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EntityTypesListItem]
$creadListPrec :: ReadPrec [EntityTypesListItem]
readPrec :: ReadPrec EntityTypesListItem
$creadPrec :: ReadPrec EntityTypesListItem
readList :: ReadS [EntityTypesListItem]
$creadList :: ReadS [EntityTypesListItem]
readsPrec :: Int -> ReadS EntityTypesListItem
$creadsPrec :: Int -> ReadS EntityTypesListItem
Prelude.Read, Int -> EntityTypesListItem -> ShowS
[EntityTypesListItem] -> ShowS
EntityTypesListItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EntityTypesListItem] -> ShowS
$cshowList :: [EntityTypesListItem] -> ShowS
show :: EntityTypesListItem -> String
$cshow :: EntityTypesListItem -> String
showsPrec :: Int -> EntityTypesListItem -> ShowS
$cshowsPrec :: Int -> EntityTypesListItem -> ShowS
Prelude.Show, forall x. Rep EntityTypesListItem x -> EntityTypesListItem
forall x. EntityTypesListItem -> Rep EntityTypesListItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EntityTypesListItem x -> EntityTypesListItem
$cfrom :: forall x. EntityTypesListItem -> Rep EntityTypesListItem x
Prelude.Generic)

-- |
-- Create a value of 'EntityTypesListItem' 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:
--
-- 'type'', 'entityTypesListItem_type' - An entity type within a labeled training dataset that Amazon Comprehend
-- uses to train a custom entity recognizer.
--
-- Entity types must not contain the following invalid characters: \\n
-- (line break), \\\\n (escaped line break, \\r (carriage return), \\\\r
-- (escaped carriage return), \\t (tab), \\\\t (escaped tab), space, and ,
-- (comma).
newEntityTypesListItem ::
  -- | 'type''
  Prelude.Text ->
  EntityTypesListItem
newEntityTypesListItem :: Text -> EntityTypesListItem
newEntityTypesListItem Text
pType_ =
  EntityTypesListItem' {$sel:type':EntityTypesListItem' :: Text
type' = Text
pType_}

-- | An entity type within a labeled training dataset that Amazon Comprehend
-- uses to train a custom entity recognizer.
--
-- Entity types must not contain the following invalid characters: \\n
-- (line break), \\\\n (escaped line break, \\r (carriage return), \\\\r
-- (escaped carriage return), \\t (tab), \\\\t (escaped tab), space, and ,
-- (comma).
entityTypesListItem_type :: Lens.Lens' EntityTypesListItem Prelude.Text
entityTypesListItem_type :: Lens' EntityTypesListItem Text
entityTypesListItem_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntityTypesListItem' {Text
type' :: Text
$sel:type':EntityTypesListItem' :: EntityTypesListItem -> Text
type'} -> Text
type') (\s :: EntityTypesListItem
s@EntityTypesListItem' {} Text
a -> EntityTypesListItem
s {$sel:type':EntityTypesListItem' :: Text
type' = Text
a} :: EntityTypesListItem)

instance Data.FromJSON EntityTypesListItem where
  parseJSON :: Value -> Parser EntityTypesListItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EntityTypesListItem"
      ( \Object
x ->
          Text -> EntityTypesListItem
EntityTypesListItem' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Type")
      )

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

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

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