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

-- | Information about an item of Personal Protective Equipment (PPE)
-- detected by DetectProtectiveEquipment. For more information, see
-- DetectProtectiveEquipment.
--
-- /See:/ 'newEquipmentDetection' smart constructor.
data EquipmentDetection = EquipmentDetection'
  { -- | A bounding box surrounding the item of detected PPE.
    EquipmentDetection -> Maybe BoundingBox
boundingBox :: Prelude.Maybe BoundingBox,
    -- | The confidence that Amazon Rekognition has that the bounding box
    -- (@BoundingBox@) contains an item of PPE.
    EquipmentDetection -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
    -- | Information about the body part covered by the detected PPE.
    EquipmentDetection -> Maybe CoversBodyPart
coversBodyPart :: Prelude.Maybe CoversBodyPart,
    -- | The type of detected PPE.
    EquipmentDetection -> Maybe ProtectiveEquipmentType
type' :: Prelude.Maybe ProtectiveEquipmentType
  }
  deriving (EquipmentDetection -> EquipmentDetection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EquipmentDetection -> EquipmentDetection -> Bool
$c/= :: EquipmentDetection -> EquipmentDetection -> Bool
== :: EquipmentDetection -> EquipmentDetection -> Bool
$c== :: EquipmentDetection -> EquipmentDetection -> Bool
Prelude.Eq, ReadPrec [EquipmentDetection]
ReadPrec EquipmentDetection
Int -> ReadS EquipmentDetection
ReadS [EquipmentDetection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EquipmentDetection]
$creadListPrec :: ReadPrec [EquipmentDetection]
readPrec :: ReadPrec EquipmentDetection
$creadPrec :: ReadPrec EquipmentDetection
readList :: ReadS [EquipmentDetection]
$creadList :: ReadS [EquipmentDetection]
readsPrec :: Int -> ReadS EquipmentDetection
$creadsPrec :: Int -> ReadS EquipmentDetection
Prelude.Read, Int -> EquipmentDetection -> ShowS
[EquipmentDetection] -> ShowS
EquipmentDetection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EquipmentDetection] -> ShowS
$cshowList :: [EquipmentDetection] -> ShowS
show :: EquipmentDetection -> String
$cshow :: EquipmentDetection -> String
showsPrec :: Int -> EquipmentDetection -> ShowS
$cshowsPrec :: Int -> EquipmentDetection -> ShowS
Prelude.Show, forall x. Rep EquipmentDetection x -> EquipmentDetection
forall x. EquipmentDetection -> Rep EquipmentDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EquipmentDetection x -> EquipmentDetection
$cfrom :: forall x. EquipmentDetection -> Rep EquipmentDetection x
Prelude.Generic)

-- |
-- Create a value of 'EquipmentDetection' 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:
--
-- 'boundingBox', 'equipmentDetection_boundingBox' - A bounding box surrounding the item of detected PPE.
--
-- 'confidence', 'equipmentDetection_confidence' - The confidence that Amazon Rekognition has that the bounding box
-- (@BoundingBox@) contains an item of PPE.
--
-- 'coversBodyPart', 'equipmentDetection_coversBodyPart' - Information about the body part covered by the detected PPE.
--
-- 'type'', 'equipmentDetection_type' - The type of detected PPE.
newEquipmentDetection ::
  EquipmentDetection
newEquipmentDetection :: EquipmentDetection
newEquipmentDetection =
  EquipmentDetection'
    { $sel:boundingBox:EquipmentDetection' :: Maybe BoundingBox
boundingBox = forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:EquipmentDetection' :: Maybe Double
confidence = forall a. Maybe a
Prelude.Nothing,
      $sel:coversBodyPart:EquipmentDetection' :: Maybe CoversBodyPart
coversBodyPart = forall a. Maybe a
Prelude.Nothing,
      $sel:type':EquipmentDetection' :: Maybe ProtectiveEquipmentType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | A bounding box surrounding the item of detected PPE.
equipmentDetection_boundingBox :: Lens.Lens' EquipmentDetection (Prelude.Maybe BoundingBox)
equipmentDetection_boundingBox :: Lens' EquipmentDetection (Maybe BoundingBox)
equipmentDetection_boundingBox = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EquipmentDetection' {Maybe BoundingBox
boundingBox :: Maybe BoundingBox
$sel:boundingBox:EquipmentDetection' :: EquipmentDetection -> Maybe BoundingBox
boundingBox} -> Maybe BoundingBox
boundingBox) (\s :: EquipmentDetection
s@EquipmentDetection' {} Maybe BoundingBox
a -> EquipmentDetection
s {$sel:boundingBox:EquipmentDetection' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
a} :: EquipmentDetection)

-- | The confidence that Amazon Rekognition has that the bounding box
-- (@BoundingBox@) contains an item of PPE.
equipmentDetection_confidence :: Lens.Lens' EquipmentDetection (Prelude.Maybe Prelude.Double)
equipmentDetection_confidence :: Lens' EquipmentDetection (Maybe Double)
equipmentDetection_confidence = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EquipmentDetection' {Maybe Double
confidence :: Maybe Double
$sel:confidence:EquipmentDetection' :: EquipmentDetection -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: EquipmentDetection
s@EquipmentDetection' {} Maybe Double
a -> EquipmentDetection
s {$sel:confidence:EquipmentDetection' :: Maybe Double
confidence = Maybe Double
a} :: EquipmentDetection)

-- | Information about the body part covered by the detected PPE.
equipmentDetection_coversBodyPart :: Lens.Lens' EquipmentDetection (Prelude.Maybe CoversBodyPart)
equipmentDetection_coversBodyPart :: Lens' EquipmentDetection (Maybe CoversBodyPart)
equipmentDetection_coversBodyPart = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EquipmentDetection' {Maybe CoversBodyPart
coversBodyPart :: Maybe CoversBodyPart
$sel:coversBodyPart:EquipmentDetection' :: EquipmentDetection -> Maybe CoversBodyPart
coversBodyPart} -> Maybe CoversBodyPart
coversBodyPart) (\s :: EquipmentDetection
s@EquipmentDetection' {} Maybe CoversBodyPart
a -> EquipmentDetection
s {$sel:coversBodyPart:EquipmentDetection' :: Maybe CoversBodyPart
coversBodyPart = Maybe CoversBodyPart
a} :: EquipmentDetection)

-- | The type of detected PPE.
equipmentDetection_type :: Lens.Lens' EquipmentDetection (Prelude.Maybe ProtectiveEquipmentType)
equipmentDetection_type :: Lens' EquipmentDetection (Maybe ProtectiveEquipmentType)
equipmentDetection_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EquipmentDetection' {Maybe ProtectiveEquipmentType
type' :: Maybe ProtectiveEquipmentType
$sel:type':EquipmentDetection' :: EquipmentDetection -> Maybe ProtectiveEquipmentType
type'} -> Maybe ProtectiveEquipmentType
type') (\s :: EquipmentDetection
s@EquipmentDetection' {} Maybe ProtectiveEquipmentType
a -> EquipmentDetection
s {$sel:type':EquipmentDetection' :: Maybe ProtectiveEquipmentType
type' = Maybe ProtectiveEquipmentType
a} :: EquipmentDetection)

instance Data.FromJSON EquipmentDetection where
  parseJSON :: Value -> Parser EquipmentDetection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EquipmentDetection"
      ( \Object
x ->
          Maybe BoundingBox
-> Maybe Double
-> Maybe CoversBodyPart
-> Maybe ProtectiveEquipmentType
-> EquipmentDetection
EquipmentDetection'
            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
"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
"CoversBodyPart")
            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
"Type")
      )

instance Prelude.Hashable EquipmentDetection where
  hashWithSalt :: Int -> EquipmentDetection -> Int
hashWithSalt Int
_salt EquipmentDetection' {Maybe Double
Maybe BoundingBox
Maybe CoversBodyPart
Maybe ProtectiveEquipmentType
type' :: Maybe ProtectiveEquipmentType
coversBodyPart :: Maybe CoversBodyPart
confidence :: Maybe Double
boundingBox :: Maybe BoundingBox
$sel:type':EquipmentDetection' :: EquipmentDetection -> Maybe ProtectiveEquipmentType
$sel:coversBodyPart:EquipmentDetection' :: EquipmentDetection -> Maybe CoversBodyPart
$sel:confidence:EquipmentDetection' :: EquipmentDetection -> Maybe Double
$sel:boundingBox:EquipmentDetection' :: EquipmentDetection -> Maybe BoundingBox
..} =
    Int
_salt
      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 CoversBodyPart
coversBodyPart
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProtectiveEquipmentType
type'

instance Prelude.NFData EquipmentDetection where
  rnf :: EquipmentDetection -> ()
rnf EquipmentDetection' {Maybe Double
Maybe BoundingBox
Maybe CoversBodyPart
Maybe ProtectiveEquipmentType
type' :: Maybe ProtectiveEquipmentType
coversBodyPart :: Maybe CoversBodyPart
confidence :: Maybe Double
boundingBox :: Maybe BoundingBox
$sel:type':EquipmentDetection' :: EquipmentDetection -> Maybe ProtectiveEquipmentType
$sel:coversBodyPart:EquipmentDetection' :: EquipmentDetection -> Maybe CoversBodyPart
$sel:confidence:EquipmentDetection' :: EquipmentDetection -> Maybe Double
$sel:boundingBox:EquipmentDetection' :: EquipmentDetection -> Maybe BoundingBox
..} =
    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 CoversBodyPart
coversBodyPart
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProtectiveEquipmentType
type'