{-# 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.ProtectiveEquipmentBodyPart
-- 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.ProtectiveEquipmentBodyPart 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.BodyPart
import Amazonka.Rekognition.Types.EquipmentDetection

-- | Information about a body part detected by DetectProtectiveEquipment that
-- contains PPE. An array of @ProtectiveEquipmentBodyPart@ objects is
-- returned for each person detected by @DetectProtectiveEquipment@.
--
-- /See:/ 'newProtectiveEquipmentBodyPart' smart constructor.
data ProtectiveEquipmentBodyPart = ProtectiveEquipmentBodyPart'
  { -- | The confidence that Amazon Rekognition has in the detection accuracy of
    -- the detected body part.
    ProtectiveEquipmentBodyPart -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
    -- | An array of Personal Protective Equipment items detected around a body
    -- part.
    ProtectiveEquipmentBodyPart -> Maybe [EquipmentDetection]
equipmentDetections :: Prelude.Maybe [EquipmentDetection],
    -- | The detected body part.
    ProtectiveEquipmentBodyPart -> Maybe BodyPart
name :: Prelude.Maybe BodyPart
  }
  deriving (ProtectiveEquipmentBodyPart -> ProtectiveEquipmentBodyPart -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProtectiveEquipmentBodyPart -> ProtectiveEquipmentBodyPart -> Bool
$c/= :: ProtectiveEquipmentBodyPart -> ProtectiveEquipmentBodyPart -> Bool
== :: ProtectiveEquipmentBodyPart -> ProtectiveEquipmentBodyPart -> Bool
$c== :: ProtectiveEquipmentBodyPart -> ProtectiveEquipmentBodyPart -> Bool
Prelude.Eq, ReadPrec [ProtectiveEquipmentBodyPart]
ReadPrec ProtectiveEquipmentBodyPart
Int -> ReadS ProtectiveEquipmentBodyPart
ReadS [ProtectiveEquipmentBodyPart]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProtectiveEquipmentBodyPart]
$creadListPrec :: ReadPrec [ProtectiveEquipmentBodyPart]
readPrec :: ReadPrec ProtectiveEquipmentBodyPart
$creadPrec :: ReadPrec ProtectiveEquipmentBodyPart
readList :: ReadS [ProtectiveEquipmentBodyPart]
$creadList :: ReadS [ProtectiveEquipmentBodyPart]
readsPrec :: Int -> ReadS ProtectiveEquipmentBodyPart
$creadsPrec :: Int -> ReadS ProtectiveEquipmentBodyPart
Prelude.Read, Int -> ProtectiveEquipmentBodyPart -> ShowS
[ProtectiveEquipmentBodyPart] -> ShowS
ProtectiveEquipmentBodyPart -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProtectiveEquipmentBodyPart] -> ShowS
$cshowList :: [ProtectiveEquipmentBodyPart] -> ShowS
show :: ProtectiveEquipmentBodyPart -> String
$cshow :: ProtectiveEquipmentBodyPart -> String
showsPrec :: Int -> ProtectiveEquipmentBodyPart -> ShowS
$cshowsPrec :: Int -> ProtectiveEquipmentBodyPart -> ShowS
Prelude.Show, forall x.
Rep ProtectiveEquipmentBodyPart x -> ProtectiveEquipmentBodyPart
forall x.
ProtectiveEquipmentBodyPart -> Rep ProtectiveEquipmentBodyPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProtectiveEquipmentBodyPart x -> ProtectiveEquipmentBodyPart
$cfrom :: forall x.
ProtectiveEquipmentBodyPart -> Rep ProtectiveEquipmentBodyPart x
Prelude.Generic)

-- |
-- Create a value of 'ProtectiveEquipmentBodyPart' 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:
--
-- 'confidence', 'protectiveEquipmentBodyPart_confidence' - The confidence that Amazon Rekognition has in the detection accuracy of
-- the detected body part.
--
-- 'equipmentDetections', 'protectiveEquipmentBodyPart_equipmentDetections' - An array of Personal Protective Equipment items detected around a body
-- part.
--
-- 'name', 'protectiveEquipmentBodyPart_name' - The detected body part.
newProtectiveEquipmentBodyPart ::
  ProtectiveEquipmentBodyPart
newProtectiveEquipmentBodyPart :: ProtectiveEquipmentBodyPart
newProtectiveEquipmentBodyPart =
  ProtectiveEquipmentBodyPart'
    { $sel:confidence:ProtectiveEquipmentBodyPart' :: Maybe Double
confidence =
        forall a. Maybe a
Prelude.Nothing,
      $sel:equipmentDetections:ProtectiveEquipmentBodyPart' :: Maybe [EquipmentDetection]
equipmentDetections = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ProtectiveEquipmentBodyPart' :: Maybe BodyPart
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The confidence that Amazon Rekognition has in the detection accuracy of
-- the detected body part.
protectiveEquipmentBodyPart_confidence :: Lens.Lens' ProtectiveEquipmentBodyPart (Prelude.Maybe Prelude.Double)
protectiveEquipmentBodyPart_confidence :: Lens' ProtectiveEquipmentBodyPart (Maybe Double)
protectiveEquipmentBodyPart_confidence = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectiveEquipmentBodyPart' {Maybe Double
confidence :: Maybe Double
$sel:confidence:ProtectiveEquipmentBodyPart' :: ProtectiveEquipmentBodyPart -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: ProtectiveEquipmentBodyPart
s@ProtectiveEquipmentBodyPart' {} Maybe Double
a -> ProtectiveEquipmentBodyPart
s {$sel:confidence:ProtectiveEquipmentBodyPart' :: Maybe Double
confidence = Maybe Double
a} :: ProtectiveEquipmentBodyPart)

-- | An array of Personal Protective Equipment items detected around a body
-- part.
protectiveEquipmentBodyPart_equipmentDetections :: Lens.Lens' ProtectiveEquipmentBodyPart (Prelude.Maybe [EquipmentDetection])
protectiveEquipmentBodyPart_equipmentDetections :: Lens' ProtectiveEquipmentBodyPart (Maybe [EquipmentDetection])
protectiveEquipmentBodyPart_equipmentDetections = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectiveEquipmentBodyPart' {Maybe [EquipmentDetection]
equipmentDetections :: Maybe [EquipmentDetection]
$sel:equipmentDetections:ProtectiveEquipmentBodyPart' :: ProtectiveEquipmentBodyPart -> Maybe [EquipmentDetection]
equipmentDetections} -> Maybe [EquipmentDetection]
equipmentDetections) (\s :: ProtectiveEquipmentBodyPart
s@ProtectiveEquipmentBodyPart' {} Maybe [EquipmentDetection]
a -> ProtectiveEquipmentBodyPart
s {$sel:equipmentDetections:ProtectiveEquipmentBodyPart' :: Maybe [EquipmentDetection]
equipmentDetections = Maybe [EquipmentDetection]
a} :: ProtectiveEquipmentBodyPart) 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

-- | The detected body part.
protectiveEquipmentBodyPart_name :: Lens.Lens' ProtectiveEquipmentBodyPart (Prelude.Maybe BodyPart)
protectiveEquipmentBodyPart_name :: Lens' ProtectiveEquipmentBodyPart (Maybe BodyPart)
protectiveEquipmentBodyPart_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectiveEquipmentBodyPart' {Maybe BodyPart
name :: Maybe BodyPart
$sel:name:ProtectiveEquipmentBodyPart' :: ProtectiveEquipmentBodyPart -> Maybe BodyPart
name} -> Maybe BodyPart
name) (\s :: ProtectiveEquipmentBodyPart
s@ProtectiveEquipmentBodyPart' {} Maybe BodyPart
a -> ProtectiveEquipmentBodyPart
s {$sel:name:ProtectiveEquipmentBodyPart' :: Maybe BodyPart
name = Maybe BodyPart
a} :: ProtectiveEquipmentBodyPart)

instance Data.FromJSON ProtectiveEquipmentBodyPart where
  parseJSON :: Value -> Parser ProtectiveEquipmentBodyPart
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProtectiveEquipmentBodyPart"
      ( \Object
x ->
          Maybe Double
-> Maybe [EquipmentDetection]
-> Maybe BodyPart
-> ProtectiveEquipmentBodyPart
ProtectiveEquipmentBodyPart'
            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
"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
"EquipmentDetections"
                            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
"Name")
      )

instance Prelude.Hashable ProtectiveEquipmentBodyPart where
  hashWithSalt :: Int -> ProtectiveEquipmentBodyPart -> Int
hashWithSalt Int
_salt ProtectiveEquipmentBodyPart' {Maybe Double
Maybe [EquipmentDetection]
Maybe BodyPart
name :: Maybe BodyPart
equipmentDetections :: Maybe [EquipmentDetection]
confidence :: Maybe Double
$sel:name:ProtectiveEquipmentBodyPart' :: ProtectiveEquipmentBodyPart -> Maybe BodyPart
$sel:equipmentDetections:ProtectiveEquipmentBodyPart' :: ProtectiveEquipmentBodyPart -> Maybe [EquipmentDetection]
$sel:confidence:ProtectiveEquipmentBodyPart' :: ProtectiveEquipmentBodyPart -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
confidence
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EquipmentDetection]
equipmentDetections
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BodyPart
name

instance Prelude.NFData ProtectiveEquipmentBodyPart where
  rnf :: ProtectiveEquipmentBodyPart -> ()
rnf ProtectiveEquipmentBodyPart' {Maybe Double
Maybe [EquipmentDetection]
Maybe BodyPart
name :: Maybe BodyPart
equipmentDetections :: Maybe [EquipmentDetection]
confidence :: Maybe Double
$sel:name:ProtectiveEquipmentBodyPart' :: ProtectiveEquipmentBodyPart -> Maybe BodyPart
$sel:equipmentDetections:ProtectiveEquipmentBodyPart' :: ProtectiveEquipmentBodyPart -> Maybe [EquipmentDetection]
$sel:confidence:ProtectiveEquipmentBodyPart' :: ProtectiveEquipmentBodyPart -> Maybe Double
..} =
    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 [EquipmentDetection]
equipmentDetections
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BodyPart
name