{-# 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.ComprehendMedical.Types.UnmappedAttribute
-- 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.ComprehendMedical.Types.UnmappedAttribute where

import Amazonka.ComprehendMedical.Types.Attribute
import Amazonka.ComprehendMedical.Types.EntityType
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 attribute that was extracted, but Comprehend Medical; was unable to
-- relate to an entity.
--
-- /See:/ 'newUnmappedAttribute' smart constructor.
data UnmappedAttribute = UnmappedAttribute'
  { -- | The specific attribute that has been extracted but not mapped to an
    -- entity.
    UnmappedAttribute -> Maybe Attribute
attribute :: Prelude.Maybe Attribute,
    -- | The type of the unmapped attribute, could be one of the following
    -- values: \"MEDICATION\", \"MEDICAL_CONDITION\", \"ANATOMY\",
    -- \"TEST_AND_TREATMENT_PROCEDURE\" or \"PROTECTED_HEALTH_INFORMATION\".
    UnmappedAttribute -> Maybe EntityType
type' :: Prelude.Maybe EntityType
  }
  deriving (UnmappedAttribute -> UnmappedAttribute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnmappedAttribute -> UnmappedAttribute -> Bool
$c/= :: UnmappedAttribute -> UnmappedAttribute -> Bool
== :: UnmappedAttribute -> UnmappedAttribute -> Bool
$c== :: UnmappedAttribute -> UnmappedAttribute -> Bool
Prelude.Eq, ReadPrec [UnmappedAttribute]
ReadPrec UnmappedAttribute
Int -> ReadS UnmappedAttribute
ReadS [UnmappedAttribute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnmappedAttribute]
$creadListPrec :: ReadPrec [UnmappedAttribute]
readPrec :: ReadPrec UnmappedAttribute
$creadPrec :: ReadPrec UnmappedAttribute
readList :: ReadS [UnmappedAttribute]
$creadList :: ReadS [UnmappedAttribute]
readsPrec :: Int -> ReadS UnmappedAttribute
$creadsPrec :: Int -> ReadS UnmappedAttribute
Prelude.Read, Int -> UnmappedAttribute -> ShowS
[UnmappedAttribute] -> ShowS
UnmappedAttribute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnmappedAttribute] -> ShowS
$cshowList :: [UnmappedAttribute] -> ShowS
show :: UnmappedAttribute -> String
$cshow :: UnmappedAttribute -> String
showsPrec :: Int -> UnmappedAttribute -> ShowS
$cshowsPrec :: Int -> UnmappedAttribute -> ShowS
Prelude.Show, forall x. Rep UnmappedAttribute x -> UnmappedAttribute
forall x. UnmappedAttribute -> Rep UnmappedAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnmappedAttribute x -> UnmappedAttribute
$cfrom :: forall x. UnmappedAttribute -> Rep UnmappedAttribute x
Prelude.Generic)

-- |
-- Create a value of 'UnmappedAttribute' 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:
--
-- 'attribute', 'unmappedAttribute_attribute' - The specific attribute that has been extracted but not mapped to an
-- entity.
--
-- 'type'', 'unmappedAttribute_type' - The type of the unmapped attribute, could be one of the following
-- values: \"MEDICATION\", \"MEDICAL_CONDITION\", \"ANATOMY\",
-- \"TEST_AND_TREATMENT_PROCEDURE\" or \"PROTECTED_HEALTH_INFORMATION\".
newUnmappedAttribute ::
  UnmappedAttribute
newUnmappedAttribute :: UnmappedAttribute
newUnmappedAttribute =
  UnmappedAttribute'
    { $sel:attribute:UnmappedAttribute' :: Maybe Attribute
attribute = forall a. Maybe a
Prelude.Nothing,
      $sel:type':UnmappedAttribute' :: Maybe EntityType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The specific attribute that has been extracted but not mapped to an
-- entity.
unmappedAttribute_attribute :: Lens.Lens' UnmappedAttribute (Prelude.Maybe Attribute)
unmappedAttribute_attribute :: Lens' UnmappedAttribute (Maybe Attribute)
unmappedAttribute_attribute = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnmappedAttribute' {Maybe Attribute
attribute :: Maybe Attribute
$sel:attribute:UnmappedAttribute' :: UnmappedAttribute -> Maybe Attribute
attribute} -> Maybe Attribute
attribute) (\s :: UnmappedAttribute
s@UnmappedAttribute' {} Maybe Attribute
a -> UnmappedAttribute
s {$sel:attribute:UnmappedAttribute' :: Maybe Attribute
attribute = Maybe Attribute
a} :: UnmappedAttribute)

-- | The type of the unmapped attribute, could be one of the following
-- values: \"MEDICATION\", \"MEDICAL_CONDITION\", \"ANATOMY\",
-- \"TEST_AND_TREATMENT_PROCEDURE\" or \"PROTECTED_HEALTH_INFORMATION\".
unmappedAttribute_type :: Lens.Lens' UnmappedAttribute (Prelude.Maybe EntityType)
unmappedAttribute_type :: Lens' UnmappedAttribute (Maybe EntityType)
unmappedAttribute_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnmappedAttribute' {Maybe EntityType
type' :: Maybe EntityType
$sel:type':UnmappedAttribute' :: UnmappedAttribute -> Maybe EntityType
type'} -> Maybe EntityType
type') (\s :: UnmappedAttribute
s@UnmappedAttribute' {} Maybe EntityType
a -> UnmappedAttribute
s {$sel:type':UnmappedAttribute' :: Maybe EntityType
type' = Maybe EntityType
a} :: UnmappedAttribute)

instance Data.FromJSON UnmappedAttribute where
  parseJSON :: Value -> Parser UnmappedAttribute
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UnmappedAttribute"
      ( \Object
x ->
          Maybe Attribute -> Maybe EntityType -> UnmappedAttribute
UnmappedAttribute'
            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
"Attribute")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Type")
      )

instance Prelude.Hashable UnmappedAttribute where
  hashWithSalt :: Int -> UnmappedAttribute -> Int
hashWithSalt Int
_salt UnmappedAttribute' {Maybe EntityType
Maybe Attribute
type' :: Maybe EntityType
attribute :: Maybe Attribute
$sel:type':UnmappedAttribute' :: UnmappedAttribute -> Maybe EntityType
$sel:attribute:UnmappedAttribute' :: UnmappedAttribute -> Maybe Attribute
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Attribute
attribute
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EntityType
type'

instance Prelude.NFData UnmappedAttribute where
  rnf :: UnmappedAttribute -> ()
rnf UnmappedAttribute' {Maybe EntityType
Maybe Attribute
type' :: Maybe EntityType
attribute :: Maybe Attribute
$sel:type':UnmappedAttribute' :: UnmappedAttribute -> Maybe EntityType
$sel:attribute:UnmappedAttribute' :: UnmappedAttribute -> Maybe Attribute
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Attribute
attribute
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EntityType
type'