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

import Amazonka.ComprehendMedical.Types.EntitySubType
import Amazonka.ComprehendMedical.Types.EntityType
import Amazonka.ComprehendMedical.Types.RelationshipType
import Amazonka.ComprehendMedical.Types.Trait
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An extracted segment of the text that is an attribute of an entity, or
-- otherwise related to an entity, such as the dosage of a medication
-- taken. It contains information about the attribute such as id, begin and
-- end offset within the input text, and the segment of the input text.
--
-- /See:/ 'newAttribute' smart constructor.
data Attribute = Attribute'
  { -- | The level of confidence that Amazon Comprehend Medical has that this
    -- attribute is correctly related to this entity.
    Attribute -> Maybe Double
relationshipScore :: Prelude.Maybe Prelude.Double,
    -- | The 0-based character offset in the input text that shows where the
    -- attribute begins. The offset returns the UTF-8 code point in the string.
    Attribute -> Maybe Int
beginOffset :: Prelude.Maybe Prelude.Int,
    -- | The segment of input text extracted as this attribute.
    Attribute -> Maybe Text
text :: Prelude.Maybe Prelude.Text,
    -- | The category of attribute.
    Attribute -> Maybe EntityType
category :: Prelude.Maybe EntityType,
    -- | The level of confidence that Amazon Comprehend Medical has that the
    -- segment of text is correctly recognized as an attribute.
    Attribute -> Maybe Double
score :: Prelude.Maybe Prelude.Double,
    -- | Contextual information for this attribute.
    Attribute -> Maybe [Trait]
traits :: Prelude.Maybe [Trait],
    -- | The type of relationship between the entity and attribute. Type for the
    -- relationship is @OVERLAP@, indicating that the entity occurred at the
    -- same time as the @Date_Expression@.
    Attribute -> Maybe RelationshipType
relationshipType :: Prelude.Maybe RelationshipType,
    -- | The 0-based character offset in the input text that shows where the
    -- attribute ends. The offset returns the UTF-8 code point in the string.
    Attribute -> Maybe Int
endOffset :: Prelude.Maybe Prelude.Int,
    -- | The numeric identifier for this attribute. This is a monotonically
    -- increasing id unique within this response rather than a global unique
    -- identifier.
    Attribute -> Maybe Int
id :: Prelude.Maybe Prelude.Int,
    -- | The type of attribute.
    Attribute -> Maybe EntitySubType
type' :: Prelude.Maybe EntitySubType
  }
  deriving (Attribute -> Attribute -> Bool
(Attribute -> Attribute -> Bool)
-> (Attribute -> Attribute -> Bool) -> Eq Attribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Attribute -> Attribute -> Bool
$c/= :: Attribute -> Attribute -> Bool
== :: Attribute -> Attribute -> Bool
$c== :: Attribute -> Attribute -> Bool
Prelude.Eq, ReadPrec [Attribute]
ReadPrec Attribute
Int -> ReadS Attribute
ReadS [Attribute]
(Int -> ReadS Attribute)
-> ReadS [Attribute]
-> ReadPrec Attribute
-> ReadPrec [Attribute]
-> Read Attribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Attribute]
$creadListPrec :: ReadPrec [Attribute]
readPrec :: ReadPrec Attribute
$creadPrec :: ReadPrec Attribute
readList :: ReadS [Attribute]
$creadList :: ReadS [Attribute]
readsPrec :: Int -> ReadS Attribute
$creadsPrec :: Int -> ReadS Attribute
Prelude.Read, Int -> Attribute -> ShowS
[Attribute] -> ShowS
Attribute -> String
(Int -> Attribute -> ShowS)
-> (Attribute -> String)
-> ([Attribute] -> ShowS)
-> Show Attribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Attribute] -> ShowS
$cshowList :: [Attribute] -> ShowS
show :: Attribute -> String
$cshow :: Attribute -> String
showsPrec :: Int -> Attribute -> ShowS
$cshowsPrec :: Int -> Attribute -> ShowS
Prelude.Show, (forall x. Attribute -> Rep Attribute x)
-> (forall x. Rep Attribute x -> Attribute) -> Generic Attribute
forall x. Rep Attribute x -> Attribute
forall x. Attribute -> Rep Attribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Attribute x -> Attribute
$cfrom :: forall x. Attribute -> Rep Attribute x
Prelude.Generic)

-- |
-- Create a value of 'Attribute' 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:
--
-- 'relationshipScore', 'attribute_relationshipScore' - The level of confidence that Amazon Comprehend Medical has that this
-- attribute is correctly related to this entity.
--
-- 'beginOffset', 'attribute_beginOffset' - The 0-based character offset in the input text that shows where the
-- attribute begins. The offset returns the UTF-8 code point in the string.
--
-- 'text', 'attribute_text' - The segment of input text extracted as this attribute.
--
-- 'category', 'attribute_category' - The category of attribute.
--
-- 'score', 'attribute_score' - The level of confidence that Amazon Comprehend Medical has that the
-- segment of text is correctly recognized as an attribute.
--
-- 'traits', 'attribute_traits' - Contextual information for this attribute.
--
-- 'relationshipType', 'attribute_relationshipType' - The type of relationship between the entity and attribute. Type for the
-- relationship is @OVERLAP@, indicating that the entity occurred at the
-- same time as the @Date_Expression@.
--
-- 'endOffset', 'attribute_endOffset' - The 0-based character offset in the input text that shows where the
-- attribute ends. The offset returns the UTF-8 code point in the string.
--
-- 'id', 'attribute_id' - The numeric identifier for this attribute. This is a monotonically
-- increasing id unique within this response rather than a global unique
-- identifier.
--
-- 'type'', 'attribute_type' - The type of attribute.
newAttribute ::
  Attribute
newAttribute :: Attribute
newAttribute =
  Attribute' :: Maybe Double
-> Maybe Int
-> Maybe Text
-> Maybe EntityType
-> Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute
Attribute'
    { $sel:relationshipScore:Attribute' :: Maybe Double
relationshipScore = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:beginOffset:Attribute' :: Maybe Int
beginOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:text:Attribute' :: Maybe Text
text = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:category:Attribute' :: Maybe EntityType
category = Maybe EntityType
forall a. Maybe a
Prelude.Nothing,
      $sel:score:Attribute' :: Maybe Double
score = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:traits:Attribute' :: Maybe [Trait]
traits = Maybe [Trait]
forall a. Maybe a
Prelude.Nothing,
      $sel:relationshipType:Attribute' :: Maybe RelationshipType
relationshipType = Maybe RelationshipType
forall a. Maybe a
Prelude.Nothing,
      $sel:endOffset:Attribute' :: Maybe Int
endOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:id:Attribute' :: Maybe Int
id = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:type':Attribute' :: Maybe EntitySubType
type' = Maybe EntitySubType
forall a. Maybe a
Prelude.Nothing
    }

-- | The level of confidence that Amazon Comprehend Medical has that this
-- attribute is correctly related to this entity.
attribute_relationshipScore :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Double)
attribute_relationshipScore :: (Maybe Double -> f (Maybe Double)) -> Attribute -> f Attribute
attribute_relationshipScore = (Attribute -> Maybe Double)
-> (Attribute -> Maybe Double -> Attribute)
-> Lens Attribute Attribute (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Double
relationshipScore :: Maybe Double
$sel:relationshipScore:Attribute' :: Attribute -> Maybe Double
relationshipScore} -> Maybe Double
relationshipScore) (\s :: Attribute
s@Attribute' {} Maybe Double
a -> Attribute
s {$sel:relationshipScore:Attribute' :: Maybe Double
relationshipScore = Maybe Double
a} :: Attribute)

-- | The 0-based character offset in the input text that shows where the
-- attribute begins. The offset returns the UTF-8 code point in the string.
attribute_beginOffset :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Int)
attribute_beginOffset :: (Maybe Int -> f (Maybe Int)) -> Attribute -> f Attribute
attribute_beginOffset = (Attribute -> Maybe Int)
-> (Attribute -> Maybe Int -> Attribute)
-> Lens Attribute Attribute (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Int
beginOffset :: Maybe Int
$sel:beginOffset:Attribute' :: Attribute -> Maybe Int
beginOffset} -> Maybe Int
beginOffset) (\s :: Attribute
s@Attribute' {} Maybe Int
a -> Attribute
s {$sel:beginOffset:Attribute' :: Maybe Int
beginOffset = Maybe Int
a} :: Attribute)

-- | The segment of input text extracted as this attribute.
attribute_text :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Text)
attribute_text :: (Maybe Text -> f (Maybe Text)) -> Attribute -> f Attribute
attribute_text = (Attribute -> Maybe Text)
-> (Attribute -> Maybe Text -> Attribute)
-> Lens Attribute Attribute (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Text
text :: Maybe Text
$sel:text:Attribute' :: Attribute -> Maybe Text
text} -> Maybe Text
text) (\s :: Attribute
s@Attribute' {} Maybe Text
a -> Attribute
s {$sel:text:Attribute' :: Maybe Text
text = Maybe Text
a} :: Attribute)

-- | The category of attribute.
attribute_category :: Lens.Lens' Attribute (Prelude.Maybe EntityType)
attribute_category :: (Maybe EntityType -> f (Maybe EntityType))
-> Attribute -> f Attribute
attribute_category = (Attribute -> Maybe EntityType)
-> (Attribute -> Maybe EntityType -> Attribute)
-> Lens Attribute Attribute (Maybe EntityType) (Maybe EntityType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe EntityType
category :: Maybe EntityType
$sel:category:Attribute' :: Attribute -> Maybe EntityType
category} -> Maybe EntityType
category) (\s :: Attribute
s@Attribute' {} Maybe EntityType
a -> Attribute
s {$sel:category:Attribute' :: Maybe EntityType
category = Maybe EntityType
a} :: Attribute)

-- | The level of confidence that Amazon Comprehend Medical has that the
-- segment of text is correctly recognized as an attribute.
attribute_score :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Double)
attribute_score :: (Maybe Double -> f (Maybe Double)) -> Attribute -> f Attribute
attribute_score = (Attribute -> Maybe Double)
-> (Attribute -> Maybe Double -> Attribute)
-> Lens Attribute Attribute (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Double
score :: Maybe Double
$sel:score:Attribute' :: Attribute -> Maybe Double
score} -> Maybe Double
score) (\s :: Attribute
s@Attribute' {} Maybe Double
a -> Attribute
s {$sel:score:Attribute' :: Maybe Double
score = Maybe Double
a} :: Attribute)

-- | Contextual information for this attribute.
attribute_traits :: Lens.Lens' Attribute (Prelude.Maybe [Trait])
attribute_traits :: (Maybe [Trait] -> f (Maybe [Trait])) -> Attribute -> f Attribute
attribute_traits = (Attribute -> Maybe [Trait])
-> (Attribute -> Maybe [Trait] -> Attribute)
-> Lens Attribute Attribute (Maybe [Trait]) (Maybe [Trait])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe [Trait]
traits :: Maybe [Trait]
$sel:traits:Attribute' :: Attribute -> Maybe [Trait]
traits} -> Maybe [Trait]
traits) (\s :: Attribute
s@Attribute' {} Maybe [Trait]
a -> Attribute
s {$sel:traits:Attribute' :: Maybe [Trait]
traits = Maybe [Trait]
a} :: Attribute) ((Maybe [Trait] -> f (Maybe [Trait])) -> Attribute -> f Attribute)
-> ((Maybe [Trait] -> f (Maybe [Trait]))
    -> Maybe [Trait] -> f (Maybe [Trait]))
-> (Maybe [Trait] -> f (Maybe [Trait]))
-> Attribute
-> f Attribute
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Trait] [Trait] [Trait] [Trait]
-> Iso
     (Maybe [Trait]) (Maybe [Trait]) (Maybe [Trait]) (Maybe [Trait])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Trait] [Trait] [Trait] [Trait]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type of relationship between the entity and attribute. Type for the
-- relationship is @OVERLAP@, indicating that the entity occurred at the
-- same time as the @Date_Expression@.
attribute_relationshipType :: Lens.Lens' Attribute (Prelude.Maybe RelationshipType)
attribute_relationshipType :: (Maybe RelationshipType -> f (Maybe RelationshipType))
-> Attribute -> f Attribute
attribute_relationshipType = (Attribute -> Maybe RelationshipType)
-> (Attribute -> Maybe RelationshipType -> Attribute)
-> Lens
     Attribute
     Attribute
     (Maybe RelationshipType)
     (Maybe RelationshipType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe RelationshipType
relationshipType :: Maybe RelationshipType
$sel:relationshipType:Attribute' :: Attribute -> Maybe RelationshipType
relationshipType} -> Maybe RelationshipType
relationshipType) (\s :: Attribute
s@Attribute' {} Maybe RelationshipType
a -> Attribute
s {$sel:relationshipType:Attribute' :: Maybe RelationshipType
relationshipType = Maybe RelationshipType
a} :: Attribute)

-- | The 0-based character offset in the input text that shows where the
-- attribute ends. The offset returns the UTF-8 code point in the string.
attribute_endOffset :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Int)
attribute_endOffset :: (Maybe Int -> f (Maybe Int)) -> Attribute -> f Attribute
attribute_endOffset = (Attribute -> Maybe Int)
-> (Attribute -> Maybe Int -> Attribute)
-> Lens Attribute Attribute (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Int
endOffset :: Maybe Int
$sel:endOffset:Attribute' :: Attribute -> Maybe Int
endOffset} -> Maybe Int
endOffset) (\s :: Attribute
s@Attribute' {} Maybe Int
a -> Attribute
s {$sel:endOffset:Attribute' :: Maybe Int
endOffset = Maybe Int
a} :: Attribute)

-- | The numeric identifier for this attribute. This is a monotonically
-- increasing id unique within this response rather than a global unique
-- identifier.
attribute_id :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Int)
attribute_id :: (Maybe Int -> f (Maybe Int)) -> Attribute -> f Attribute
attribute_id = (Attribute -> Maybe Int)
-> (Attribute -> Maybe Int -> Attribute)
-> Lens Attribute Attribute (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Int
id :: Maybe Int
$sel:id:Attribute' :: Attribute -> Maybe Int
id} -> Maybe Int
id) (\s :: Attribute
s@Attribute' {} Maybe Int
a -> Attribute
s {$sel:id:Attribute' :: Maybe Int
id = Maybe Int
a} :: Attribute)

-- | The type of attribute.
attribute_type :: Lens.Lens' Attribute (Prelude.Maybe EntitySubType)
attribute_type :: (Maybe EntitySubType -> f (Maybe EntitySubType))
-> Attribute -> f Attribute
attribute_type = (Attribute -> Maybe EntitySubType)
-> (Attribute -> Maybe EntitySubType -> Attribute)
-> Lens
     Attribute Attribute (Maybe EntitySubType) (Maybe EntitySubType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe EntitySubType
type' :: Maybe EntitySubType
$sel:type':Attribute' :: Attribute -> Maybe EntitySubType
type'} -> Maybe EntitySubType
type') (\s :: Attribute
s@Attribute' {} Maybe EntitySubType
a -> Attribute
s {$sel:type':Attribute' :: Maybe EntitySubType
type' = Maybe EntitySubType
a} :: Attribute)

instance Core.FromJSON Attribute where
  parseJSON :: Value -> Parser Attribute
parseJSON =
    String -> (Object -> Parser Attribute) -> Value -> Parser Attribute
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Attribute"
      ( \Object
x ->
          Maybe Double
-> Maybe Int
-> Maybe Text
-> Maybe EntityType
-> Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute
Attribute'
            (Maybe Double
 -> Maybe Int
 -> Maybe Text
 -> Maybe EntityType
 -> Maybe Double
 -> Maybe [Trait]
 -> Maybe RelationshipType
 -> Maybe Int
 -> Maybe Int
 -> Maybe EntitySubType
 -> Attribute)
-> Parser (Maybe Double)
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe EntityType
      -> Maybe Double
      -> Maybe [Trait]
      -> Maybe RelationshipType
      -> Maybe Int
      -> Maybe Int
      -> Maybe EntitySubType
      -> Attribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RelationshipScore")
            Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe EntityType
   -> Maybe Double
   -> Maybe [Trait]
   -> Maybe RelationshipType
   -> Maybe Int
   -> Maybe Int
   -> Maybe EntitySubType
   -> Attribute)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe EntityType
      -> Maybe Double
      -> Maybe [Trait]
      -> Maybe RelationshipType
      -> Maybe Int
      -> Maybe Int
      -> Maybe EntitySubType
      -> Attribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BeginOffset")
            Parser
  (Maybe Text
   -> Maybe EntityType
   -> Maybe Double
   -> Maybe [Trait]
   -> Maybe RelationshipType
   -> Maybe Int
   -> Maybe Int
   -> Maybe EntitySubType
   -> Attribute)
-> Parser (Maybe Text)
-> Parser
     (Maybe EntityType
      -> Maybe Double
      -> Maybe [Trait]
      -> Maybe RelationshipType
      -> Maybe Int
      -> Maybe Int
      -> Maybe EntitySubType
      -> Attribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Text")
            Parser
  (Maybe EntityType
   -> Maybe Double
   -> Maybe [Trait]
   -> Maybe RelationshipType
   -> Maybe Int
   -> Maybe Int
   -> Maybe EntitySubType
   -> Attribute)
-> Parser (Maybe EntityType)
-> Parser
     (Maybe Double
      -> Maybe [Trait]
      -> Maybe RelationshipType
      -> Maybe Int
      -> Maybe Int
      -> Maybe EntitySubType
      -> Attribute)
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
"Category")
            Parser
  (Maybe Double
   -> Maybe [Trait]
   -> Maybe RelationshipType
   -> Maybe Int
   -> Maybe Int
   -> Maybe EntitySubType
   -> Attribute)
-> Parser (Maybe Double)
-> Parser
     (Maybe [Trait]
      -> Maybe RelationshipType
      -> Maybe Int
      -> Maybe Int
      -> Maybe EntitySubType
      -> Attribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Score")
            Parser
  (Maybe [Trait]
   -> Maybe RelationshipType
   -> Maybe Int
   -> Maybe Int
   -> Maybe EntitySubType
   -> Attribute)
-> Parser (Maybe [Trait])
-> Parser
     (Maybe RelationshipType
      -> Maybe Int -> Maybe Int -> Maybe EntitySubType -> Attribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Trait]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Traits" Parser (Maybe (Maybe [Trait]))
-> Maybe [Trait] -> Parser (Maybe [Trait])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Trait]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe RelationshipType
   -> Maybe Int -> Maybe Int -> Maybe EntitySubType -> Attribute)
-> Parser (Maybe RelationshipType)
-> Parser
     (Maybe Int -> Maybe Int -> Maybe EntitySubType -> Attribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RelationshipType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RelationshipType")
            Parser (Maybe Int -> Maybe Int -> Maybe EntitySubType -> Attribute)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe EntitySubType -> Attribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndOffset")
            Parser (Maybe Int -> Maybe EntitySubType -> Attribute)
-> Parser (Maybe Int) -> Parser (Maybe EntitySubType -> Attribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
            Parser (Maybe EntitySubType -> Attribute)
-> Parser (Maybe EntitySubType) -> Parser Attribute
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EntitySubType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
      )

instance Prelude.Hashable Attribute

instance Prelude.NFData Attribute