{-# 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.SNOMEDCTTrait
-- 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.SNOMEDCTTrait where

import Amazonka.ComprehendMedical.Types.SNOMEDCTTraitName
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

-- | Contextual information for an entity.
--
-- /See:/ 'newSNOMEDCTTrait' smart constructor.
data SNOMEDCTTrait = SNOMEDCTTrait'
  { -- | The name or contextual description of a detected trait.
    SNOMEDCTTrait -> Maybe SNOMEDCTTraitName
name :: Prelude.Maybe SNOMEDCTTraitName,
    -- | The level of confidence that Comprehend Medical has in the accuracy of a
    -- detected trait.
    SNOMEDCTTrait -> Maybe Double
score :: Prelude.Maybe Prelude.Double
  }
  deriving (SNOMEDCTTrait -> SNOMEDCTTrait -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SNOMEDCTTrait -> SNOMEDCTTrait -> Bool
$c/= :: SNOMEDCTTrait -> SNOMEDCTTrait -> Bool
== :: SNOMEDCTTrait -> SNOMEDCTTrait -> Bool
$c== :: SNOMEDCTTrait -> SNOMEDCTTrait -> Bool
Prelude.Eq, ReadPrec [SNOMEDCTTrait]
ReadPrec SNOMEDCTTrait
Int -> ReadS SNOMEDCTTrait
ReadS [SNOMEDCTTrait]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SNOMEDCTTrait]
$creadListPrec :: ReadPrec [SNOMEDCTTrait]
readPrec :: ReadPrec SNOMEDCTTrait
$creadPrec :: ReadPrec SNOMEDCTTrait
readList :: ReadS [SNOMEDCTTrait]
$creadList :: ReadS [SNOMEDCTTrait]
readsPrec :: Int -> ReadS SNOMEDCTTrait
$creadsPrec :: Int -> ReadS SNOMEDCTTrait
Prelude.Read, Int -> SNOMEDCTTrait -> ShowS
[SNOMEDCTTrait] -> ShowS
SNOMEDCTTrait -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SNOMEDCTTrait] -> ShowS
$cshowList :: [SNOMEDCTTrait] -> ShowS
show :: SNOMEDCTTrait -> String
$cshow :: SNOMEDCTTrait -> String
showsPrec :: Int -> SNOMEDCTTrait -> ShowS
$cshowsPrec :: Int -> SNOMEDCTTrait -> ShowS
Prelude.Show, forall x. Rep SNOMEDCTTrait x -> SNOMEDCTTrait
forall x. SNOMEDCTTrait -> Rep SNOMEDCTTrait x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SNOMEDCTTrait x -> SNOMEDCTTrait
$cfrom :: forall x. SNOMEDCTTrait -> Rep SNOMEDCTTrait x
Prelude.Generic)

-- |
-- Create a value of 'SNOMEDCTTrait' 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:
--
-- 'name', 'sNOMEDCTTrait_name' - The name or contextual description of a detected trait.
--
-- 'score', 'sNOMEDCTTrait_score' - The level of confidence that Comprehend Medical has in the accuracy of a
-- detected trait.
newSNOMEDCTTrait ::
  SNOMEDCTTrait
newSNOMEDCTTrait :: SNOMEDCTTrait
newSNOMEDCTTrait =
  SNOMEDCTTrait'
    { $sel:name:SNOMEDCTTrait' :: Maybe SNOMEDCTTraitName
name = forall a. Maybe a
Prelude.Nothing,
      $sel:score:SNOMEDCTTrait' :: Maybe Double
score = forall a. Maybe a
Prelude.Nothing
    }

-- | The name or contextual description of a detected trait.
sNOMEDCTTrait_name :: Lens.Lens' SNOMEDCTTrait (Prelude.Maybe SNOMEDCTTraitName)
sNOMEDCTTrait_name :: Lens' SNOMEDCTTrait (Maybe SNOMEDCTTraitName)
sNOMEDCTTrait_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SNOMEDCTTrait' {Maybe SNOMEDCTTraitName
name :: Maybe SNOMEDCTTraitName
$sel:name:SNOMEDCTTrait' :: SNOMEDCTTrait -> Maybe SNOMEDCTTraitName
name} -> Maybe SNOMEDCTTraitName
name) (\s :: SNOMEDCTTrait
s@SNOMEDCTTrait' {} Maybe SNOMEDCTTraitName
a -> SNOMEDCTTrait
s {$sel:name:SNOMEDCTTrait' :: Maybe SNOMEDCTTraitName
name = Maybe SNOMEDCTTraitName
a} :: SNOMEDCTTrait)

-- | The level of confidence that Comprehend Medical has in the accuracy of a
-- detected trait.
sNOMEDCTTrait_score :: Lens.Lens' SNOMEDCTTrait (Prelude.Maybe Prelude.Double)
sNOMEDCTTrait_score :: Lens' SNOMEDCTTrait (Maybe Double)
sNOMEDCTTrait_score = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SNOMEDCTTrait' {Maybe Double
score :: Maybe Double
$sel:score:SNOMEDCTTrait' :: SNOMEDCTTrait -> Maybe Double
score} -> Maybe Double
score) (\s :: SNOMEDCTTrait
s@SNOMEDCTTrait' {} Maybe Double
a -> SNOMEDCTTrait
s {$sel:score:SNOMEDCTTrait' :: Maybe Double
score = Maybe Double
a} :: SNOMEDCTTrait)

instance Data.FromJSON SNOMEDCTTrait where
  parseJSON :: Value -> Parser SNOMEDCTTrait
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SNOMEDCTTrait"
      ( \Object
x ->
          Maybe SNOMEDCTTraitName -> Maybe Double -> SNOMEDCTTrait
SNOMEDCTTrait'
            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
"Name")
            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
"Score")
      )

instance Prelude.Hashable SNOMEDCTTrait where
  hashWithSalt :: Int -> SNOMEDCTTrait -> Int
hashWithSalt Int
_salt SNOMEDCTTrait' {Maybe Double
Maybe SNOMEDCTTraitName
score :: Maybe Double
name :: Maybe SNOMEDCTTraitName
$sel:score:SNOMEDCTTrait' :: SNOMEDCTTrait -> Maybe Double
$sel:name:SNOMEDCTTrait' :: SNOMEDCTTrait -> Maybe SNOMEDCTTraitName
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SNOMEDCTTraitName
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
score

instance Prelude.NFData SNOMEDCTTrait where
  rnf :: SNOMEDCTTrait -> ()
rnf SNOMEDCTTrait' {Maybe Double
Maybe SNOMEDCTTraitName
score :: Maybe Double
name :: Maybe SNOMEDCTTraitName
$sel:score:SNOMEDCTTrait' :: SNOMEDCTTrait -> Maybe Double
$sel:name:SNOMEDCTTrait' :: SNOMEDCTTrait -> Maybe SNOMEDCTTraitName
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SNOMEDCTTraitName
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
score