{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Rekognition.Types.ProtectiveEquipmentPerson where

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
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
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]
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
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.
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'
    { $sel:bodyParts:ProtectiveEquipmentPerson' :: Maybe [ProtectiveEquipmentBodyPart]
bodyParts =
        forall a. Maybe a
Prelude.Nothing,
      $sel:boundingBox:ProtectiveEquipmentPerson' :: Maybe BoundingBox
boundingBox = forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:ProtectiveEquipmentPerson' :: Maybe Double
confidence = forall a. Maybe a
Prelude.Nothing,
      $sel:id:ProtectiveEquipmentPerson' :: Maybe Natural
id = 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 :: Lens'
  ProtectiveEquipmentPerson (Maybe [ProtectiveEquipmentBodyPart])
protectiveEquipmentPerson_bodyParts = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' ProtectiveEquipmentPerson (Maybe BoundingBox)
protectiveEquipmentPerson_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 :: Lens' ProtectiveEquipmentPerson (Maybe Double)
protectiveEquipmentPerson_confidence = 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 :: Lens' ProtectiveEquipmentPerson (Maybe Natural)
protectiveEquipmentPerson_id = 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 Data.FromJSON ProtectiveEquipmentPerson where
  parseJSON :: Value -> Parser ProtectiveEquipmentPerson
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProtectiveEquipmentPerson"
      ( \Object
x ->
          Maybe [ProtectiveEquipmentBodyPart]
-> Maybe BoundingBox
-> Maybe Double
-> Maybe Natural
-> ProtectiveEquipmentPerson
ProtectiveEquipmentPerson'
            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
"BodyParts" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"BoundingBox")
            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
"Confidence")
            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
"Id")
      )

instance Prelude.Hashable ProtectiveEquipmentPerson where
  hashWithSalt :: Int -> ProtectiveEquipmentPerson -> Int
hashWithSalt Int
_salt ProtectiveEquipmentPerson' {Maybe Double
Maybe Natural
Maybe [ProtectiveEquipmentBodyPart]
Maybe BoundingBox
id :: Maybe Natural
confidence :: Maybe Double
boundingBox :: Maybe BoundingBox
bodyParts :: Maybe [ProtectiveEquipmentBodyPart]
$sel:id:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe Natural
$sel:confidence:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe Double
$sel:boundingBox:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe BoundingBox
$sel:bodyParts:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe [ProtectiveEquipmentBodyPart]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ProtectiveEquipmentBodyPart]
bodyParts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BoundingBox
boundingBox
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
confidence
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
id

instance Prelude.NFData ProtectiveEquipmentPerson where
  rnf :: ProtectiveEquipmentPerson -> ()
rnf ProtectiveEquipmentPerson' {Maybe Double
Maybe Natural
Maybe [ProtectiveEquipmentBodyPart]
Maybe BoundingBox
id :: Maybe Natural
confidence :: Maybe Double
boundingBox :: Maybe BoundingBox
bodyParts :: Maybe [ProtectiveEquipmentBodyPart]
$sel:id:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe Natural
$sel:confidence:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe Double
$sel:boundingBox:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe BoundingBox
$sel:bodyParts:ProtectiveEquipmentPerson' :: ProtectiveEquipmentPerson -> Maybe [ProtectiveEquipmentBodyPart]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ProtectiveEquipmentBodyPart]
bodyParts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BoundingBox
boundingBox
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
confidence
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
id