{-# 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-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.EquipmentDetection 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.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,
    -- | Information about the body part covered by the detected PPE.
    EquipmentDetection -> Maybe CoversBodyPart
coversBodyPart :: Prelude.Maybe CoversBodyPart,
    -- | The confidence that Amazon Rekognition has that the bounding box
    -- (@BoundingBox@) contains an item of PPE.
    EquipmentDetection -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
    -- | The type of detected PPE.
    EquipmentDetection -> Maybe ProtectiveEquipmentType
type' :: Prelude.Maybe ProtectiveEquipmentType
  }
  deriving (EquipmentDetection -> EquipmentDetection -> Bool
(EquipmentDetection -> EquipmentDetection -> Bool)
-> (EquipmentDetection -> EquipmentDetection -> Bool)
-> Eq EquipmentDetection
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]
(Int -> ReadS EquipmentDetection)
-> ReadS [EquipmentDetection]
-> ReadPrec EquipmentDetection
-> ReadPrec [EquipmentDetection]
-> Read 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
(Int -> EquipmentDetection -> ShowS)
-> (EquipmentDetection -> String)
-> ([EquipmentDetection] -> ShowS)
-> Show EquipmentDetection
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. EquipmentDetection -> Rep EquipmentDetection x)
-> (forall x. Rep EquipmentDetection x -> EquipmentDetection)
-> Generic EquipmentDetection
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.
--
-- 'coversBodyPart', 'equipmentDetection_coversBodyPart' - Information about the body part covered by the detected PPE.
--
-- 'confidence', 'equipmentDetection_confidence' - The confidence that Amazon Rekognition has that the bounding box
-- (@BoundingBox@) contains an item of PPE.
--
-- 'type'', 'equipmentDetection_type' - The type of detected PPE.
newEquipmentDetection ::
  EquipmentDetection
newEquipmentDetection :: EquipmentDetection
newEquipmentDetection =
  EquipmentDetection' :: Maybe BoundingBox
-> Maybe CoversBodyPart
-> Maybe Double
-> Maybe ProtectiveEquipmentType
-> EquipmentDetection
EquipmentDetection'
    { $sel:boundingBox:EquipmentDetection' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
forall a. Maybe a
Prelude.Nothing,
      $sel:coversBodyPart:EquipmentDetection' :: Maybe CoversBodyPart
coversBodyPart = Maybe CoversBodyPart
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:EquipmentDetection' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:type':EquipmentDetection' :: Maybe ProtectiveEquipmentType
type' = Maybe ProtectiveEquipmentType
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 :: (Maybe BoundingBox -> f (Maybe BoundingBox))
-> EquipmentDetection -> f EquipmentDetection
equipmentDetection_boundingBox = (EquipmentDetection -> Maybe BoundingBox)
-> (EquipmentDetection -> Maybe BoundingBox -> EquipmentDetection)
-> Lens
     EquipmentDetection
     EquipmentDetection
     (Maybe BoundingBox)
     (Maybe 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)

-- | Information about the body part covered by the detected PPE.
equipmentDetection_coversBodyPart :: Lens.Lens' EquipmentDetection (Prelude.Maybe CoversBodyPart)
equipmentDetection_coversBodyPart :: (Maybe CoversBodyPart -> f (Maybe CoversBodyPart))
-> EquipmentDetection -> f EquipmentDetection
equipmentDetection_coversBodyPart = (EquipmentDetection -> Maybe CoversBodyPart)
-> (EquipmentDetection
    -> Maybe CoversBodyPart -> EquipmentDetection)
-> Lens
     EquipmentDetection
     EquipmentDetection
     (Maybe CoversBodyPart)
     (Maybe 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 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 :: (Maybe Double -> f (Maybe Double))
-> EquipmentDetection -> f EquipmentDetection
equipmentDetection_confidence = (EquipmentDetection -> Maybe Double)
-> (EquipmentDetection -> Maybe Double -> EquipmentDetection)
-> Lens
     EquipmentDetection EquipmentDetection (Maybe Double) (Maybe Double)
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)

-- | The type of detected PPE.
equipmentDetection_type :: Lens.Lens' EquipmentDetection (Prelude.Maybe ProtectiveEquipmentType)
equipmentDetection_type :: (Maybe ProtectiveEquipmentType
 -> f (Maybe ProtectiveEquipmentType))
-> EquipmentDetection -> f EquipmentDetection
equipmentDetection_type = (EquipmentDetection -> Maybe ProtectiveEquipmentType)
-> (EquipmentDetection
    -> Maybe ProtectiveEquipmentType -> EquipmentDetection)
-> Lens
     EquipmentDetection
     EquipmentDetection
     (Maybe ProtectiveEquipmentType)
     (Maybe ProtectiveEquipmentType)
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 Core.FromJSON EquipmentDetection where
  parseJSON :: Value -> Parser EquipmentDetection
parseJSON =
    String
-> (Object -> Parser EquipmentDetection)
-> Value
-> Parser EquipmentDetection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EquipmentDetection"
      ( \Object
x ->
          Maybe BoundingBox
-> Maybe CoversBodyPart
-> Maybe Double
-> Maybe ProtectiveEquipmentType
-> EquipmentDetection
EquipmentDetection'
            (Maybe BoundingBox
 -> Maybe CoversBodyPart
 -> Maybe Double
 -> Maybe ProtectiveEquipmentType
 -> EquipmentDetection)
-> Parser (Maybe BoundingBox)
-> Parser
     (Maybe CoversBodyPart
      -> Maybe Double
      -> Maybe ProtectiveEquipmentType
      -> EquipmentDetection)
forall (f :: * -> *) a b. Functor 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 CoversBodyPart
   -> Maybe Double
   -> Maybe ProtectiveEquipmentType
   -> EquipmentDetection)
-> Parser (Maybe CoversBodyPart)
-> Parser
     (Maybe Double
      -> Maybe ProtectiveEquipmentType -> EquipmentDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CoversBodyPart)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CoversBodyPart")
            Parser
  (Maybe Double
   -> Maybe ProtectiveEquipmentType -> EquipmentDetection)
-> Parser (Maybe Double)
-> Parser (Maybe ProtectiveEquipmentType -> EquipmentDetection)
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 ProtectiveEquipmentType -> EquipmentDetection)
-> Parser (Maybe ProtectiveEquipmentType)
-> Parser EquipmentDetection
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProtectiveEquipmentType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
      )

instance Prelude.Hashable EquipmentDetection

instance Prelude.NFData EquipmentDetection