{-# 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.Rekognition.Types.ProtectiveEquipmentPerson
-- 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.Rekognition.Types.ProtectiveEquipmentPerson where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types.BoundingBox
import Amazonka.Rekognition.Types.ProtectiveEquipmentBodyPart

-- | A person detected by a call to DetectProtectiveEquipment. The API
-- returns all persons detected in the input image in an array of
-- @ProtectiveEquipmentPerson@ objects.
--
-- /See:/ 'newProtectiveEquipmentPerson' smart constructor.
data ProtectiveEquipmentPerson = ProtectiveEquipmentPerson'
  { -- | An array of body parts detected on a person\'s body (including body
    -- parts without PPE).
    ProtectiveEquipmentPerson -> Maybe [ProtectiveEquipmentBodyPart]
bodyParts :: Prelude.Maybe [ProtectiveEquipmentBodyPart],
    -- | A bounding box around the detected person.
    ProtectiveEquipmentPerson -> Maybe BoundingBox
boundingBox :: Prelude.Maybe BoundingBox,
    -- | The confidence that Amazon Rekognition has that the bounding box
    -- contains a person.
    ProtectiveEquipmentPerson -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
    -- | The identifier for the detected person. The identifier is only unique
    -- for a single call to @DetectProtectiveEquipment@.
    ProtectiveEquipmentPerson -> Maybe Natural
id :: Prelude.Maybe Prelude.Natural
  }
  deriving (ProtectiveEquipmentPerson -> ProtectiveEquipmentPerson -> Bool
(ProtectiveEquipmentPerson -> ProtectiveEquipmentPerson -> Bool)
-> (ProtectiveEquipmentPerson -> ProtectiveEquipmentPerson -> Bool)
-> Eq ProtectiveEquipmentPerson
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProtectiveEquipmentPerson -> ProtectiveEquipmentPerson -> Bool
$c/= :: ProtectiveEquipmentPerson -> ProtectiveEquipmentPerson -> Bool
== :: ProtectiveEquipmentPerson -> ProtectiveEquipmentPerson -> Bool
$c== :: ProtectiveEquipmentPerson -> ProtectiveEquipmentPerson -> Bool
Prelude.Eq, ReadPrec [ProtectiveEquipmentPerson]
ReadPrec ProtectiveEquipmentPerson
Int -> ReadS ProtectiveEquipmentPerson
ReadS [ProtectiveEquipmentPerson]
(Int -> ReadS ProtectiveEquipmentPerson)
-> ReadS [ProtectiveEquipmentPerson]
-> ReadPrec ProtectiveEquipmentPerson
-> ReadPrec [ProtectiveEquipmentPerson]
-> Read ProtectiveEquipmentPerson
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProtectiveEquipmentPerson]
$creadListPrec :: ReadPrec [ProtectiveEquipmentPerson]
readPrec :: ReadPrec ProtectiveEquipmentPerson
$creadPrec :: ReadPrec ProtectiveEquipmentPerson
readList :: ReadS [ProtectiveEquipmentPerson]
$creadList :: ReadS [ProtectiveEquipmentPerson]
readsPrec :: Int -> ReadS ProtectiveEquipmentPerson
$creadsPrec :: Int -> ReadS ProtectiveEquipmentPerson
Prelude.Read, Int -> ProtectiveEquipmentPerson -> ShowS
[ProtectiveEquipmentPerson] -> ShowS
ProtectiveEquipmentPerson -> String
(Int -> ProtectiveEquipmentPerson -> ShowS)
-> (ProtectiveEquipmentPerson -> String)
-> ([ProtectiveEquipmentPerson] -> ShowS)
-> Show ProtectiveEquipmentPerson
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProtectiveEquipmentPerson] -> ShowS
$cshowList :: [ProtectiveEquipmentPerson] -> ShowS
show :: ProtectiveEquipmentPerson -> String
$cshow :: ProtectiveEquipmentPerson -> String
showsPrec :: Int -> ProtectiveEquipmentPerson -> ShowS
$cshowsPrec :: Int -> ProtectiveEquipmentPerson -> ShowS
Prelude.Show, (forall x.
 ProtectiveEquipmentPerson -> Rep ProtectiveEquipmentPerson x)
-> (forall x.
    Rep ProtectiveEquipmentPerson x -> ProtectiveEquipmentPerson)
-> Generic ProtectiveEquipmentPerson
forall x.
Rep ProtectiveEquipmentPerson x -> ProtectiveEquipmentPerson
forall x.
ProtectiveEquipmentPerson -> Rep ProtectiveEquipmentPerson x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProtectiveEquipmentPerson x -> ProtectiveEquipmentPerson
$cfrom :: forall x.
ProtectiveEquipmentPerson -> Rep ProtectiveEquipmentPerson x
Prelude.Generic)

-- |
-- Create a value of 'ProtectiveEquipmentPerson' 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:
--
-- 'bodyParts', 'protectiveEquipmentPerson_bodyParts' - An array of body parts detected on a person\'s body (including body
-- parts without PPE).
--
-- 'boundingBox', 'protectiveEquipmentPerson_boundingBox' - A bounding box around the detected person.
--
-- 'confidence', 'protectiveEquipmentPerson_confidence' - The confidence that Amazon Rekognition has that the bounding box
-- contains a person.
--
-- 'id', 'protectiveEquipmentPerson_id' - The identifier for the detected person. The identifier is only unique
-- for a single call to @DetectProtectiveEquipment@.
newProtectiveEquipmentPerson ::
  ProtectiveEquipmentPerson
newProtectiveEquipmentPerson :: ProtectiveEquipmentPerson
newProtectiveEquipmentPerson =
  ProtectiveEquipmentPerson' :: Maybe [ProtectiveEquipmentBodyPart]
-> Maybe BoundingBox
-> Maybe Double
-> Maybe Natural
-> ProtectiveEquipmentPerson
ProtectiveEquipmentPerson'
    { $sel:bodyParts:ProtectiveEquipmentPerson' :: Maybe [ProtectiveEquipmentBodyPart]
bodyParts =
        Maybe [ProtectiveEquipmentBodyPart]
forall a. Maybe a
Prelude.Nothing,
      $sel:boundingBox:ProtectiveEquipmentPerson' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:ProtectiveEquipmentPerson' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ProtectiveEquipmentPerson' :: Maybe Natural
id = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | An array of body parts detected on a person\'s body (including body
-- parts without PPE).
protectiveEquipmentPerson_bodyParts :: Lens.Lens' ProtectiveEquipmentPerson (Prelude.Maybe [ProtectiveEquipmentBodyPart])
protectiveEquipmentPerson_bodyParts :: (Maybe [ProtectiveEquipmentBodyPart]
 -> f (Maybe [ProtectiveEquipmentBodyPart]))
-> ProtectiveEquipmentPerson -> f ProtectiveEquipmentPerson
protectiveEquipmentPerson_bodyParts = (ProtectiveEquipmentPerson -> Maybe [ProtectiveEquipmentBodyPart])
-> (ProtectiveEquipmentPerson
    -> Maybe [ProtectiveEquipmentBodyPart]
    -> ProtectiveEquipmentPerson)
-> Lens
     ProtectiveEquipmentPerson
     ProtectiveEquipmentPerson
     (Maybe [ProtectiveEquipmentBodyPart])
     (Maybe [ProtectiveEquipmentBodyPart])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectiveEquipmentPerson' {Maybe [ProtectiveEquipmentBodyPart]
bodyParts :: Maybe [ProtectiveEquipmentBodyPart]
$sel:bodyParts:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe [ProtectiveEquipmentBodyPart]
bodyParts} -> Maybe [ProtectiveEquipmentBodyPart]
bodyParts) (\s :: ProtectiveEquipmentPerson
s@ProtectiveEquipmentPerson' {} Maybe [ProtectiveEquipmentBodyPart]
a -> ProtectiveEquipmentPerson
s {$sel:bodyParts:ProtectiveEquipmentPerson' :: Maybe [ProtectiveEquipmentBodyPart]
bodyParts = Maybe [ProtectiveEquipmentBodyPart]
a} :: ProtectiveEquipmentPerson) ((Maybe [ProtectiveEquipmentBodyPart]
  -> f (Maybe [ProtectiveEquipmentBodyPart]))
 -> ProtectiveEquipmentPerson -> f ProtectiveEquipmentPerson)
-> ((Maybe [ProtectiveEquipmentBodyPart]
     -> f (Maybe [ProtectiveEquipmentBodyPart]))
    -> Maybe [ProtectiveEquipmentBodyPart]
    -> f (Maybe [ProtectiveEquipmentBodyPart]))
-> (Maybe [ProtectiveEquipmentBodyPart]
    -> f (Maybe [ProtectiveEquipmentBodyPart]))
-> ProtectiveEquipmentPerson
-> f ProtectiveEquipmentPerson
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ProtectiveEquipmentBodyPart]
  [ProtectiveEquipmentBodyPart]
  [ProtectiveEquipmentBodyPart]
  [ProtectiveEquipmentBodyPart]
-> Iso
     (Maybe [ProtectiveEquipmentBodyPart])
     (Maybe [ProtectiveEquipmentBodyPart])
     (Maybe [ProtectiveEquipmentBodyPart])
     (Maybe [ProtectiveEquipmentBodyPart])
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
  [ProtectiveEquipmentBodyPart]
  [ProtectiveEquipmentBodyPart]
  [ProtectiveEquipmentBodyPart]
  [ProtectiveEquipmentBodyPart]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A bounding box around the detected person.
protectiveEquipmentPerson_boundingBox :: Lens.Lens' ProtectiveEquipmentPerson (Prelude.Maybe BoundingBox)
protectiveEquipmentPerson_boundingBox :: (Maybe BoundingBox -> f (Maybe BoundingBox))
-> ProtectiveEquipmentPerson -> f ProtectiveEquipmentPerson
protectiveEquipmentPerson_boundingBox = (ProtectiveEquipmentPerson -> Maybe BoundingBox)
-> (ProtectiveEquipmentPerson
    -> Maybe BoundingBox -> ProtectiveEquipmentPerson)
-> Lens
     ProtectiveEquipmentPerson
     ProtectiveEquipmentPerson
     (Maybe BoundingBox)
     (Maybe BoundingBox)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectiveEquipmentPerson' {Maybe BoundingBox
boundingBox :: Maybe BoundingBox
$sel:boundingBox:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe BoundingBox
boundingBox} -> Maybe BoundingBox
boundingBox) (\s :: ProtectiveEquipmentPerson
s@ProtectiveEquipmentPerson' {} Maybe BoundingBox
a -> ProtectiveEquipmentPerson
s {$sel:boundingBox:ProtectiveEquipmentPerson' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
a} :: ProtectiveEquipmentPerson)

-- | The confidence that Amazon Rekognition has that the bounding box
-- contains a person.
protectiveEquipmentPerson_confidence :: Lens.Lens' ProtectiveEquipmentPerson (Prelude.Maybe Prelude.Double)
protectiveEquipmentPerson_confidence :: (Maybe Double -> f (Maybe Double))
-> ProtectiveEquipmentPerson -> f ProtectiveEquipmentPerson
protectiveEquipmentPerson_confidence = (ProtectiveEquipmentPerson -> Maybe Double)
-> (ProtectiveEquipmentPerson
    -> Maybe Double -> ProtectiveEquipmentPerson)
-> Lens
     ProtectiveEquipmentPerson
     ProtectiveEquipmentPerson
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectiveEquipmentPerson' {Maybe Double
confidence :: Maybe Double
$sel:confidence:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: ProtectiveEquipmentPerson
s@ProtectiveEquipmentPerson' {} Maybe Double
a -> ProtectiveEquipmentPerson
s {$sel:confidence:ProtectiveEquipmentPerson' :: Maybe Double
confidence = Maybe Double
a} :: ProtectiveEquipmentPerson)

-- | The identifier for the detected person. The identifier is only unique
-- for a single call to @DetectProtectiveEquipment@.
protectiveEquipmentPerson_id :: Lens.Lens' ProtectiveEquipmentPerson (Prelude.Maybe Prelude.Natural)
protectiveEquipmentPerson_id :: (Maybe Natural -> f (Maybe Natural))
-> ProtectiveEquipmentPerson -> f ProtectiveEquipmentPerson
protectiveEquipmentPerson_id = (ProtectiveEquipmentPerson -> Maybe Natural)
-> (ProtectiveEquipmentPerson
    -> Maybe Natural -> ProtectiveEquipmentPerson)
-> Lens
     ProtectiveEquipmentPerson
     ProtectiveEquipmentPerson
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectiveEquipmentPerson' {Maybe Natural
id :: Maybe Natural
$sel:id:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe Natural
id} -> Maybe Natural
id) (\s :: ProtectiveEquipmentPerson
s@ProtectiveEquipmentPerson' {} Maybe Natural
a -> ProtectiveEquipmentPerson
s {$sel:id:ProtectiveEquipmentPerson' :: Maybe Natural
id = Maybe Natural
a} :: ProtectiveEquipmentPerson)

instance Core.FromJSON ProtectiveEquipmentPerson where
  parseJSON :: Value -> Parser ProtectiveEquipmentPerson
parseJSON =
    String
-> (Object -> Parser ProtectiveEquipmentPerson)
-> Value
-> Parser ProtectiveEquipmentPerson
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProtectiveEquipmentPerson"
      ( \Object
x ->
          Maybe [ProtectiveEquipmentBodyPart]
-> Maybe BoundingBox
-> Maybe Double
-> Maybe Natural
-> ProtectiveEquipmentPerson
ProtectiveEquipmentPerson'
            (Maybe [ProtectiveEquipmentBodyPart]
 -> Maybe BoundingBox
 -> Maybe Double
 -> Maybe Natural
 -> ProtectiveEquipmentPerson)
-> Parser (Maybe [ProtectiveEquipmentBodyPart])
-> Parser
     (Maybe BoundingBox
      -> Maybe Double -> Maybe Natural -> ProtectiveEquipmentPerson)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe [ProtectiveEquipmentBodyPart]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BodyParts" Parser (Maybe (Maybe [ProtectiveEquipmentBodyPart]))
-> Maybe [ProtectiveEquipmentBodyPart]
-> Parser (Maybe [ProtectiveEquipmentBodyPart])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ProtectiveEquipmentBodyPart]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe BoundingBox
   -> Maybe Double -> Maybe Natural -> ProtectiveEquipmentPerson)
-> Parser (Maybe BoundingBox)
-> Parser
     (Maybe Double -> Maybe Natural -> ProtectiveEquipmentPerson)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe BoundingBox)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BoundingBox")
            Parser (Maybe Double -> Maybe Natural -> ProtectiveEquipmentPerson)
-> Parser (Maybe Double)
-> Parser (Maybe Natural -> ProtectiveEquipmentPerson)
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
"Confidence")
            Parser (Maybe Natural -> ProtectiveEquipmentPerson)
-> Parser (Maybe Natural) -> Parser ProtectiveEquipmentPerson
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
      )

instance Prelude.Hashable ProtectiveEquipmentPerson

instance Prelude.NFData ProtectiveEquipmentPerson