{-# 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.CoversBodyPart
-- 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.CoversBodyPart where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about an item of Personal Protective Equipment covering a
-- corresponding body part. For more information, see
-- DetectProtectiveEquipment.
--
-- /See:/ 'newCoversBodyPart' smart constructor.
data CoversBodyPart = CoversBodyPart'
  { -- | True if the PPE covers the corresponding body part, otherwise false.
    CoversBodyPart -> Maybe Bool
value :: Prelude.Maybe Prelude.Bool,
    -- | The confidence that Amazon Rekognition has in the value of @Value@.
    CoversBodyPart -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double
  }
  deriving (CoversBodyPart -> CoversBodyPart -> Bool
(CoversBodyPart -> CoversBodyPart -> Bool)
-> (CoversBodyPart -> CoversBodyPart -> Bool) -> Eq CoversBodyPart
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CoversBodyPart -> CoversBodyPart -> Bool
$c/= :: CoversBodyPart -> CoversBodyPart -> Bool
== :: CoversBodyPart -> CoversBodyPart -> Bool
$c== :: CoversBodyPart -> CoversBodyPart -> Bool
Prelude.Eq, ReadPrec [CoversBodyPart]
ReadPrec CoversBodyPart
Int -> ReadS CoversBodyPart
ReadS [CoversBodyPart]
(Int -> ReadS CoversBodyPart)
-> ReadS [CoversBodyPart]
-> ReadPrec CoversBodyPart
-> ReadPrec [CoversBodyPart]
-> Read CoversBodyPart
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CoversBodyPart]
$creadListPrec :: ReadPrec [CoversBodyPart]
readPrec :: ReadPrec CoversBodyPart
$creadPrec :: ReadPrec CoversBodyPart
readList :: ReadS [CoversBodyPart]
$creadList :: ReadS [CoversBodyPart]
readsPrec :: Int -> ReadS CoversBodyPart
$creadsPrec :: Int -> ReadS CoversBodyPart
Prelude.Read, Int -> CoversBodyPart -> ShowS
[CoversBodyPart] -> ShowS
CoversBodyPart -> String
(Int -> CoversBodyPart -> ShowS)
-> (CoversBodyPart -> String)
-> ([CoversBodyPart] -> ShowS)
-> Show CoversBodyPart
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CoversBodyPart] -> ShowS
$cshowList :: [CoversBodyPart] -> ShowS
show :: CoversBodyPart -> String
$cshow :: CoversBodyPart -> String
showsPrec :: Int -> CoversBodyPart -> ShowS
$cshowsPrec :: Int -> CoversBodyPart -> ShowS
Prelude.Show, (forall x. CoversBodyPart -> Rep CoversBodyPart x)
-> (forall x. Rep CoversBodyPart x -> CoversBodyPart)
-> Generic CoversBodyPart
forall x. Rep CoversBodyPart x -> CoversBodyPart
forall x. CoversBodyPart -> Rep CoversBodyPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CoversBodyPart x -> CoversBodyPart
$cfrom :: forall x. CoversBodyPart -> Rep CoversBodyPart x
Prelude.Generic)

-- |
-- Create a value of 'CoversBodyPart' 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:
--
-- 'value', 'coversBodyPart_value' - True if the PPE covers the corresponding body part, otherwise false.
--
-- 'confidence', 'coversBodyPart_confidence' - The confidence that Amazon Rekognition has in the value of @Value@.
newCoversBodyPart ::
  CoversBodyPart
newCoversBodyPart :: CoversBodyPart
newCoversBodyPart =
  CoversBodyPart' :: Maybe Bool -> Maybe Double -> CoversBodyPart
CoversBodyPart'
    { $sel:value:CoversBodyPart' :: Maybe Bool
value = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:CoversBodyPart' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | True if the PPE covers the corresponding body part, otherwise false.
coversBodyPart_value :: Lens.Lens' CoversBodyPart (Prelude.Maybe Prelude.Bool)
coversBodyPart_value :: (Maybe Bool -> f (Maybe Bool))
-> CoversBodyPart -> f CoversBodyPart
coversBodyPart_value = (CoversBodyPart -> Maybe Bool)
-> (CoversBodyPart -> Maybe Bool -> CoversBodyPart)
-> Lens CoversBodyPart CoversBodyPart (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoversBodyPart' {Maybe Bool
value :: Maybe Bool
$sel:value:CoversBodyPart' :: CoversBodyPart -> Maybe Bool
value} -> Maybe Bool
value) (\s :: CoversBodyPart
s@CoversBodyPart' {} Maybe Bool
a -> CoversBodyPart
s {$sel:value:CoversBodyPart' :: Maybe Bool
value = Maybe Bool
a} :: CoversBodyPart)

-- | The confidence that Amazon Rekognition has in the value of @Value@.
coversBodyPart_confidence :: Lens.Lens' CoversBodyPart (Prelude.Maybe Prelude.Double)
coversBodyPart_confidence :: (Maybe Double -> f (Maybe Double))
-> CoversBodyPart -> f CoversBodyPart
coversBodyPart_confidence = (CoversBodyPart -> Maybe Double)
-> (CoversBodyPart -> Maybe Double -> CoversBodyPart)
-> Lens CoversBodyPart CoversBodyPart (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoversBodyPart' {Maybe Double
confidence :: Maybe Double
$sel:confidence:CoversBodyPart' :: CoversBodyPart -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: CoversBodyPart
s@CoversBodyPart' {} Maybe Double
a -> CoversBodyPart
s {$sel:confidence:CoversBodyPart' :: Maybe Double
confidence = Maybe Double
a} :: CoversBodyPart)

instance Core.FromJSON CoversBodyPart where
  parseJSON :: Value -> Parser CoversBodyPart
parseJSON =
    String
-> (Object -> Parser CoversBodyPart)
-> Value
-> Parser CoversBodyPart
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CoversBodyPart"
      ( \Object
x ->
          Maybe Bool -> Maybe Double -> CoversBodyPart
CoversBodyPart'
            (Maybe Bool -> Maybe Double -> CoversBodyPart)
-> Parser (Maybe Bool) -> Parser (Maybe Double -> CoversBodyPart)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value")
            Parser (Maybe Double -> CoversBodyPart)
-> Parser (Maybe Double) -> Parser CoversBodyPart
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")
      )

instance Prelude.Hashable CoversBodyPart

instance Prelude.NFData CoversBodyPart