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

import Amazonka.ComprehendMedical.Types.Attribute
import Amazonka.ComprehendMedical.Types.EntityType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An attribute that we extracted, but were 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 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
(UnmappedAttribute -> UnmappedAttribute -> Bool)
-> (UnmappedAttribute -> UnmappedAttribute -> Bool)
-> Eq UnmappedAttribute
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]
(Int -> ReadS UnmappedAttribute)
-> ReadS [UnmappedAttribute]
-> ReadPrec UnmappedAttribute
-> ReadPrec [UnmappedAttribute]
-> Read 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
(Int -> UnmappedAttribute -> ShowS)
-> (UnmappedAttribute -> String)
-> ([UnmappedAttribute] -> ShowS)
-> Show UnmappedAttribute
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. UnmappedAttribute -> Rep UnmappedAttribute x)
-> (forall x. Rep UnmappedAttribute x -> UnmappedAttribute)
-> Generic UnmappedAttribute
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 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' :: Maybe Attribute -> Maybe EntityType -> UnmappedAttribute
UnmappedAttribute'
    { $sel:attribute:UnmappedAttribute' :: Maybe Attribute
attribute = Maybe Attribute
forall a. Maybe a
Prelude.Nothing,
      $sel:type':UnmappedAttribute' :: Maybe EntityType
type' = Maybe EntityType
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 :: (Maybe Attribute -> f (Maybe Attribute))
-> UnmappedAttribute -> f UnmappedAttribute
unmappedAttribute_attribute = (UnmappedAttribute -> Maybe Attribute)
-> (UnmappedAttribute -> Maybe Attribute -> UnmappedAttribute)
-> Lens
     UnmappedAttribute
     UnmappedAttribute
     (Maybe Attribute)
     (Maybe 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 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 :: (Maybe EntityType -> f (Maybe EntityType))
-> UnmappedAttribute -> f UnmappedAttribute
unmappedAttribute_type = (UnmappedAttribute -> Maybe EntityType)
-> (UnmappedAttribute -> Maybe EntityType -> UnmappedAttribute)
-> Lens
     UnmappedAttribute
     UnmappedAttribute
     (Maybe EntityType)
     (Maybe EntityType)
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 Core.FromJSON UnmappedAttribute where
  parseJSON :: Value -> Parser UnmappedAttribute
parseJSON =
    String
-> (Object -> Parser UnmappedAttribute)
-> Value
-> Parser UnmappedAttribute
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UnmappedAttribute"
      ( \Object
x ->
          Maybe Attribute -> Maybe EntityType -> UnmappedAttribute
UnmappedAttribute'
            (Maybe Attribute -> Maybe EntityType -> UnmappedAttribute)
-> Parser (Maybe Attribute)
-> Parser (Maybe EntityType -> UnmappedAttribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Attribute)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Attribute")
            Parser (Maybe EntityType -> UnmappedAttribute)
-> Parser (Maybe EntityType) -> Parser UnmappedAttribute
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EntityType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
      )

instance Prelude.Hashable UnmappedAttribute

instance Prelude.NFData UnmappedAttribute