{-# 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 #-}
module Amazonka.Comprehend.Types.PiiEntity where
import Amazonka.Comprehend.Types.PiiEntityType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PiiEntity = PiiEntity'
{
PiiEntity -> Maybe Int
beginOffset :: Prelude.Maybe Prelude.Int,
PiiEntity -> Maybe Double
score :: Prelude.Maybe Prelude.Double,
PiiEntity -> Maybe Int
endOffset :: Prelude.Maybe Prelude.Int,
PiiEntity -> Maybe PiiEntityType
type' :: Prelude.Maybe PiiEntityType
}
deriving (PiiEntity -> PiiEntity -> Bool
(PiiEntity -> PiiEntity -> Bool)
-> (PiiEntity -> PiiEntity -> Bool) -> Eq PiiEntity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PiiEntity -> PiiEntity -> Bool
$c/= :: PiiEntity -> PiiEntity -> Bool
== :: PiiEntity -> PiiEntity -> Bool
$c== :: PiiEntity -> PiiEntity -> Bool
Prelude.Eq, ReadPrec [PiiEntity]
ReadPrec PiiEntity
Int -> ReadS PiiEntity
ReadS [PiiEntity]
(Int -> ReadS PiiEntity)
-> ReadS [PiiEntity]
-> ReadPrec PiiEntity
-> ReadPrec [PiiEntity]
-> Read PiiEntity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PiiEntity]
$creadListPrec :: ReadPrec [PiiEntity]
readPrec :: ReadPrec PiiEntity
$creadPrec :: ReadPrec PiiEntity
readList :: ReadS [PiiEntity]
$creadList :: ReadS [PiiEntity]
readsPrec :: Int -> ReadS PiiEntity
$creadsPrec :: Int -> ReadS PiiEntity
Prelude.Read, Int -> PiiEntity -> ShowS
[PiiEntity] -> ShowS
PiiEntity -> String
(Int -> PiiEntity -> ShowS)
-> (PiiEntity -> String)
-> ([PiiEntity] -> ShowS)
-> Show PiiEntity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PiiEntity] -> ShowS
$cshowList :: [PiiEntity] -> ShowS
show :: PiiEntity -> String
$cshow :: PiiEntity -> String
showsPrec :: Int -> PiiEntity -> ShowS
$cshowsPrec :: Int -> PiiEntity -> ShowS
Prelude.Show, (forall x. PiiEntity -> Rep PiiEntity x)
-> (forall x. Rep PiiEntity x -> PiiEntity) -> Generic PiiEntity
forall x. Rep PiiEntity x -> PiiEntity
forall x. PiiEntity -> Rep PiiEntity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PiiEntity x -> PiiEntity
$cfrom :: forall x. PiiEntity -> Rep PiiEntity x
Prelude.Generic)
newPiiEntity ::
PiiEntity
newPiiEntity :: PiiEntity
newPiiEntity =
PiiEntity' :: Maybe Int
-> Maybe Double -> Maybe Int -> Maybe PiiEntityType -> PiiEntity
PiiEntity'
{ $sel:beginOffset:PiiEntity' :: Maybe Int
beginOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:score:PiiEntity' :: Maybe Double
score = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:endOffset:PiiEntity' :: Maybe Int
endOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:type':PiiEntity' :: Maybe PiiEntityType
type' = Maybe PiiEntityType
forall a. Maybe a
Prelude.Nothing
}
piiEntity_beginOffset :: Lens.Lens' PiiEntity (Prelude.Maybe Prelude.Int)
piiEntity_beginOffset :: (Maybe Int -> f (Maybe Int)) -> PiiEntity -> f PiiEntity
piiEntity_beginOffset = (PiiEntity -> Maybe Int)
-> (PiiEntity -> Maybe Int -> PiiEntity)
-> Lens PiiEntity PiiEntity (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PiiEntity' {Maybe Int
beginOffset :: Maybe Int
$sel:beginOffset:PiiEntity' :: PiiEntity -> Maybe Int
beginOffset} -> Maybe Int
beginOffset) (\s :: PiiEntity
s@PiiEntity' {} Maybe Int
a -> PiiEntity
s {$sel:beginOffset:PiiEntity' :: Maybe Int
beginOffset = Maybe Int
a} :: PiiEntity)
piiEntity_score :: Lens.Lens' PiiEntity (Prelude.Maybe Prelude.Double)
piiEntity_score :: (Maybe Double -> f (Maybe Double)) -> PiiEntity -> f PiiEntity
piiEntity_score = (PiiEntity -> Maybe Double)
-> (PiiEntity -> Maybe Double -> PiiEntity)
-> Lens PiiEntity PiiEntity (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PiiEntity' {Maybe Double
score :: Maybe Double
$sel:score:PiiEntity' :: PiiEntity -> Maybe Double
score} -> Maybe Double
score) (\s :: PiiEntity
s@PiiEntity' {} Maybe Double
a -> PiiEntity
s {$sel:score:PiiEntity' :: Maybe Double
score = Maybe Double
a} :: PiiEntity)
piiEntity_endOffset :: Lens.Lens' PiiEntity (Prelude.Maybe Prelude.Int)
piiEntity_endOffset :: (Maybe Int -> f (Maybe Int)) -> PiiEntity -> f PiiEntity
piiEntity_endOffset = (PiiEntity -> Maybe Int)
-> (PiiEntity -> Maybe Int -> PiiEntity)
-> Lens PiiEntity PiiEntity (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PiiEntity' {Maybe Int
endOffset :: Maybe Int
$sel:endOffset:PiiEntity' :: PiiEntity -> Maybe Int
endOffset} -> Maybe Int
endOffset) (\s :: PiiEntity
s@PiiEntity' {} Maybe Int
a -> PiiEntity
s {$sel:endOffset:PiiEntity' :: Maybe Int
endOffset = Maybe Int
a} :: PiiEntity)
piiEntity_type :: Lens.Lens' PiiEntity (Prelude.Maybe PiiEntityType)
piiEntity_type :: (Maybe PiiEntityType -> f (Maybe PiiEntityType))
-> PiiEntity -> f PiiEntity
piiEntity_type = (PiiEntity -> Maybe PiiEntityType)
-> (PiiEntity -> Maybe PiiEntityType -> PiiEntity)
-> Lens
PiiEntity PiiEntity (Maybe PiiEntityType) (Maybe PiiEntityType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PiiEntity' {Maybe PiiEntityType
type' :: Maybe PiiEntityType
$sel:type':PiiEntity' :: PiiEntity -> Maybe PiiEntityType
type'} -> Maybe PiiEntityType
type') (\s :: PiiEntity
s@PiiEntity' {} Maybe PiiEntityType
a -> PiiEntity
s {$sel:type':PiiEntity' :: Maybe PiiEntityType
type' = Maybe PiiEntityType
a} :: PiiEntity)
instance Core.FromJSON PiiEntity where
parseJSON :: Value -> Parser PiiEntity
parseJSON =
String -> (Object -> Parser PiiEntity) -> Value -> Parser PiiEntity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PiiEntity"
( \Object
x ->
Maybe Int
-> Maybe Double -> Maybe Int -> Maybe PiiEntityType -> PiiEntity
PiiEntity'
(Maybe Int
-> Maybe Double -> Maybe Int -> Maybe PiiEntityType -> PiiEntity)
-> Parser (Maybe Int)
-> Parser
(Maybe Double -> Maybe Int -> Maybe PiiEntityType -> PiiEntity)
forall (f :: * -> *) a b. Functor 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 Double -> Maybe Int -> Maybe PiiEntityType -> PiiEntity)
-> Parser (Maybe Double)
-> Parser (Maybe Int -> Maybe PiiEntityType -> PiiEntity)
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 Int -> Maybe PiiEntityType -> PiiEntity)
-> Parser (Maybe Int) -> Parser (Maybe PiiEntityType -> PiiEntity)
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 PiiEntityType -> PiiEntity)
-> Parser (Maybe PiiEntityType) -> Parser PiiEntity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PiiEntityType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
)
instance Prelude.Hashable PiiEntity
instance Prelude.NFData PiiEntity