{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Comprehend.Types.EntityTypesListItem where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(EntityTypesListItem -> EntityTypesListItem -> Bool)
-> (EntityTypesListItem -> EntityTypesListItem -> Bool)
-> Eq EntityTypesListItem
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]
(Int -> ReadS EntityTypesListItem)
-> ReadS [EntityTypesListItem]
-> ReadPrec EntityTypesListItem
-> ReadPrec [EntityTypesListItem]
-> Read 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
(Int -> EntityTypesListItem -> ShowS)
-> (EntityTypesListItem -> String)
-> ([EntityTypesListItem] -> ShowS)
-> Show EntityTypesListItem
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. EntityTypesListItem -> Rep EntityTypesListItem x)
-> (forall x. Rep EntityTypesListItem x -> EntityTypesListItem)
-> Generic EntityTypesListItem
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' :: Text -> EntityTypesListItem
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 :: (Text -> f Text) -> EntityTypesListItem -> f EntityTypesListItem
entityTypesListItem_type = (EntityTypesListItem -> Text)
-> (EntityTypesListItem -> Text -> EntityTypesListItem)
-> Lens EntityTypesListItem EntityTypesListItem Text Text
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 Core.FromJSON EntityTypesListItem where
  parseJSON :: Value -> Parser EntityTypesListItem
parseJSON =
    String
-> (Object -> Parser EntityTypesListItem)
-> Value
-> Parser EntityTypesListItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EntityTypesListItem"
      ( \Object
x ->
          Text -> EntityTypesListItem
EntityTypesListItem' (Text -> EntityTypesListItem)
-> Parser Text -> Parser EntityTypesListItem
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
      )

instance Prelude.Hashable EntityTypesListItem

instance Prelude.NFData EntityTypesListItem

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