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

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

-- | Summary information for required items of personal protective equipment
-- (PPE) detected on persons by a call to DetectProtectiveEquipment. You
-- specify the required type of PPE in the @SummarizationAttributes@
-- (ProtectiveEquipmentSummarizationAttributes) input parameter. The
-- summary includes which persons were detected wearing the required
-- personal protective equipment (@PersonsWithRequiredEquipment@), which
-- persons were detected as not wearing the required PPE
-- (@PersonsWithoutRequiredEquipment@), and the persons in which a
-- determination could not be made (@PersonsIndeterminate@).
--
-- To get a total for each category, use the size of the field array. For
-- example, to find out how many people were detected as wearing the
-- specified PPE, use the size of the @PersonsWithRequiredEquipment@ array.
-- If you want to find out more about a person, such as the location
-- (BoundingBox) of the person on the image, use the person ID in each
-- array element. Each person ID matches the ID field of a
-- ProtectiveEquipmentPerson object returned in the @Persons@ array by
-- @DetectProtectiveEquipment@.
--
-- /See:/ 'newProtectiveEquipmentSummary' smart constructor.
data ProtectiveEquipmentSummary = ProtectiveEquipmentSummary'
  { -- | An array of IDs for persons who are wearing detected personal protective
    -- equipment.
    ProtectiveEquipmentSummary -> Maybe [Natural]
personsWithRequiredEquipment :: Prelude.Maybe [Prelude.Natural],
    -- | An array of IDs for persons who are not wearing all of the types of PPE
    -- specified in the @RequiredEquipmentTypes@ field of the detected personal
    -- protective equipment.
    ProtectiveEquipmentSummary -> Maybe [Natural]
personsWithoutRequiredEquipment :: Prelude.Maybe [Prelude.Natural],
    -- | An array of IDs for persons where it was not possible to determine if
    -- they are wearing personal protective equipment.
    ProtectiveEquipmentSummary -> Maybe [Natural]
personsIndeterminate :: Prelude.Maybe [Prelude.Natural]
  }
  deriving (ProtectiveEquipmentSummary -> ProtectiveEquipmentSummary -> Bool
(ProtectiveEquipmentSummary -> ProtectiveEquipmentSummary -> Bool)
-> (ProtectiveEquipmentSummary
    -> ProtectiveEquipmentSummary -> Bool)
-> Eq ProtectiveEquipmentSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProtectiveEquipmentSummary -> ProtectiveEquipmentSummary -> Bool
$c/= :: ProtectiveEquipmentSummary -> ProtectiveEquipmentSummary -> Bool
== :: ProtectiveEquipmentSummary -> ProtectiveEquipmentSummary -> Bool
$c== :: ProtectiveEquipmentSummary -> ProtectiveEquipmentSummary -> Bool
Prelude.Eq, ReadPrec [ProtectiveEquipmentSummary]
ReadPrec ProtectiveEquipmentSummary
Int -> ReadS ProtectiveEquipmentSummary
ReadS [ProtectiveEquipmentSummary]
(Int -> ReadS ProtectiveEquipmentSummary)
-> ReadS [ProtectiveEquipmentSummary]
-> ReadPrec ProtectiveEquipmentSummary
-> ReadPrec [ProtectiveEquipmentSummary]
-> Read ProtectiveEquipmentSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProtectiveEquipmentSummary]
$creadListPrec :: ReadPrec [ProtectiveEquipmentSummary]
readPrec :: ReadPrec ProtectiveEquipmentSummary
$creadPrec :: ReadPrec ProtectiveEquipmentSummary
readList :: ReadS [ProtectiveEquipmentSummary]
$creadList :: ReadS [ProtectiveEquipmentSummary]
readsPrec :: Int -> ReadS ProtectiveEquipmentSummary
$creadsPrec :: Int -> ReadS ProtectiveEquipmentSummary
Prelude.Read, Int -> ProtectiveEquipmentSummary -> ShowS
[ProtectiveEquipmentSummary] -> ShowS
ProtectiveEquipmentSummary -> String
(Int -> ProtectiveEquipmentSummary -> ShowS)
-> (ProtectiveEquipmentSummary -> String)
-> ([ProtectiveEquipmentSummary] -> ShowS)
-> Show ProtectiveEquipmentSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProtectiveEquipmentSummary] -> ShowS
$cshowList :: [ProtectiveEquipmentSummary] -> ShowS
show :: ProtectiveEquipmentSummary -> String
$cshow :: ProtectiveEquipmentSummary -> String
showsPrec :: Int -> ProtectiveEquipmentSummary -> ShowS
$cshowsPrec :: Int -> ProtectiveEquipmentSummary -> ShowS
Prelude.Show, (forall x.
 ProtectiveEquipmentSummary -> Rep ProtectiveEquipmentSummary x)
-> (forall x.
    Rep ProtectiveEquipmentSummary x -> ProtectiveEquipmentSummary)
-> Generic ProtectiveEquipmentSummary
forall x.
Rep ProtectiveEquipmentSummary x -> ProtectiveEquipmentSummary
forall x.
ProtectiveEquipmentSummary -> Rep ProtectiveEquipmentSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProtectiveEquipmentSummary x -> ProtectiveEquipmentSummary
$cfrom :: forall x.
ProtectiveEquipmentSummary -> Rep ProtectiveEquipmentSummary x
Prelude.Generic)

-- |
-- Create a value of 'ProtectiveEquipmentSummary' 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:
--
-- 'personsWithRequiredEquipment', 'protectiveEquipmentSummary_personsWithRequiredEquipment' - An array of IDs for persons who are wearing detected personal protective
-- equipment.
--
-- 'personsWithoutRequiredEquipment', 'protectiveEquipmentSummary_personsWithoutRequiredEquipment' - An array of IDs for persons who are not wearing all of the types of PPE
-- specified in the @RequiredEquipmentTypes@ field of the detected personal
-- protective equipment.
--
-- 'personsIndeterminate', 'protectiveEquipmentSummary_personsIndeterminate' - An array of IDs for persons where it was not possible to determine if
-- they are wearing personal protective equipment.
newProtectiveEquipmentSummary ::
  ProtectiveEquipmentSummary
newProtectiveEquipmentSummary :: ProtectiveEquipmentSummary
newProtectiveEquipmentSummary =
  ProtectiveEquipmentSummary' :: Maybe [Natural]
-> Maybe [Natural] -> Maybe [Natural] -> ProtectiveEquipmentSummary
ProtectiveEquipmentSummary'
    { $sel:personsWithRequiredEquipment:ProtectiveEquipmentSummary' :: Maybe [Natural]
personsWithRequiredEquipment =
        Maybe [Natural]
forall a. Maybe a
Prelude.Nothing,
      $sel:personsWithoutRequiredEquipment:ProtectiveEquipmentSummary' :: Maybe [Natural]
personsWithoutRequiredEquipment =
        Maybe [Natural]
forall a. Maybe a
Prelude.Nothing,
      $sel:personsIndeterminate:ProtectiveEquipmentSummary' :: Maybe [Natural]
personsIndeterminate = Maybe [Natural]
forall a. Maybe a
Prelude.Nothing
    }

-- | An array of IDs for persons who are wearing detected personal protective
-- equipment.
protectiveEquipmentSummary_personsWithRequiredEquipment :: Lens.Lens' ProtectiveEquipmentSummary (Prelude.Maybe [Prelude.Natural])
protectiveEquipmentSummary_personsWithRequiredEquipment :: (Maybe [Natural] -> f (Maybe [Natural]))
-> ProtectiveEquipmentSummary -> f ProtectiveEquipmentSummary
protectiveEquipmentSummary_personsWithRequiredEquipment = (ProtectiveEquipmentSummary -> Maybe [Natural])
-> (ProtectiveEquipmentSummary
    -> Maybe [Natural] -> ProtectiveEquipmentSummary)
-> Lens
     ProtectiveEquipmentSummary
     ProtectiveEquipmentSummary
     (Maybe [Natural])
     (Maybe [Natural])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectiveEquipmentSummary' {Maybe [Natural]
personsWithRequiredEquipment :: Maybe [Natural]
$sel:personsWithRequiredEquipment:ProtectiveEquipmentSummary' :: ProtectiveEquipmentSummary -> Maybe [Natural]
personsWithRequiredEquipment} -> Maybe [Natural]
personsWithRequiredEquipment) (\s :: ProtectiveEquipmentSummary
s@ProtectiveEquipmentSummary' {} Maybe [Natural]
a -> ProtectiveEquipmentSummary
s {$sel:personsWithRequiredEquipment:ProtectiveEquipmentSummary' :: Maybe [Natural]
personsWithRequiredEquipment = Maybe [Natural]
a} :: ProtectiveEquipmentSummary) ((Maybe [Natural] -> f (Maybe [Natural]))
 -> ProtectiveEquipmentSummary -> f ProtectiveEquipmentSummary)
-> ((Maybe [Natural] -> f (Maybe [Natural]))
    -> Maybe [Natural] -> f (Maybe [Natural]))
-> (Maybe [Natural] -> f (Maybe [Natural]))
-> ProtectiveEquipmentSummary
-> f ProtectiveEquipmentSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Natural] [Natural] [Natural] [Natural]
-> Iso
     (Maybe [Natural])
     (Maybe [Natural])
     (Maybe [Natural])
     (Maybe [Natural])
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 AnIso [Natural] [Natural] [Natural] [Natural]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An array of IDs for persons who are not wearing all of the types of PPE
-- specified in the @RequiredEquipmentTypes@ field of the detected personal
-- protective equipment.
protectiveEquipmentSummary_personsWithoutRequiredEquipment :: Lens.Lens' ProtectiveEquipmentSummary (Prelude.Maybe [Prelude.Natural])
protectiveEquipmentSummary_personsWithoutRequiredEquipment :: (Maybe [Natural] -> f (Maybe [Natural]))
-> ProtectiveEquipmentSummary -> f ProtectiveEquipmentSummary
protectiveEquipmentSummary_personsWithoutRequiredEquipment = (ProtectiveEquipmentSummary -> Maybe [Natural])
-> (ProtectiveEquipmentSummary
    -> Maybe [Natural] -> ProtectiveEquipmentSummary)
-> Lens
     ProtectiveEquipmentSummary
     ProtectiveEquipmentSummary
     (Maybe [Natural])
     (Maybe [Natural])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectiveEquipmentSummary' {Maybe [Natural]
personsWithoutRequiredEquipment :: Maybe [Natural]
$sel:personsWithoutRequiredEquipment:ProtectiveEquipmentSummary' :: ProtectiveEquipmentSummary -> Maybe [Natural]
personsWithoutRequiredEquipment} -> Maybe [Natural]
personsWithoutRequiredEquipment) (\s :: ProtectiveEquipmentSummary
s@ProtectiveEquipmentSummary' {} Maybe [Natural]
a -> ProtectiveEquipmentSummary
s {$sel:personsWithoutRequiredEquipment:ProtectiveEquipmentSummary' :: Maybe [Natural]
personsWithoutRequiredEquipment = Maybe [Natural]
a} :: ProtectiveEquipmentSummary) ((Maybe [Natural] -> f (Maybe [Natural]))
 -> ProtectiveEquipmentSummary -> f ProtectiveEquipmentSummary)
-> ((Maybe [Natural] -> f (Maybe [Natural]))
    -> Maybe [Natural] -> f (Maybe [Natural]))
-> (Maybe [Natural] -> f (Maybe [Natural]))
-> ProtectiveEquipmentSummary
-> f ProtectiveEquipmentSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Natural] [Natural] [Natural] [Natural]
-> Iso
     (Maybe [Natural])
     (Maybe [Natural])
     (Maybe [Natural])
     (Maybe [Natural])
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 AnIso [Natural] [Natural] [Natural] [Natural]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An array of IDs for persons where it was not possible to determine if
-- they are wearing personal protective equipment.
protectiveEquipmentSummary_personsIndeterminate :: Lens.Lens' ProtectiveEquipmentSummary (Prelude.Maybe [Prelude.Natural])
protectiveEquipmentSummary_personsIndeterminate :: (Maybe [Natural] -> f (Maybe [Natural]))
-> ProtectiveEquipmentSummary -> f ProtectiveEquipmentSummary
protectiveEquipmentSummary_personsIndeterminate = (ProtectiveEquipmentSummary -> Maybe [Natural])
-> (ProtectiveEquipmentSummary
    -> Maybe [Natural] -> ProtectiveEquipmentSummary)
-> Lens
     ProtectiveEquipmentSummary
     ProtectiveEquipmentSummary
     (Maybe [Natural])
     (Maybe [Natural])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtectiveEquipmentSummary' {Maybe [Natural]
personsIndeterminate :: Maybe [Natural]
$sel:personsIndeterminate:ProtectiveEquipmentSummary' :: ProtectiveEquipmentSummary -> Maybe [Natural]
personsIndeterminate} -> Maybe [Natural]
personsIndeterminate) (\s :: ProtectiveEquipmentSummary
s@ProtectiveEquipmentSummary' {} Maybe [Natural]
a -> ProtectiveEquipmentSummary
s {$sel:personsIndeterminate:ProtectiveEquipmentSummary' :: Maybe [Natural]
personsIndeterminate = Maybe [Natural]
a} :: ProtectiveEquipmentSummary) ((Maybe [Natural] -> f (Maybe [Natural]))
 -> ProtectiveEquipmentSummary -> f ProtectiveEquipmentSummary)
-> ((Maybe [Natural] -> f (Maybe [Natural]))
    -> Maybe [Natural] -> f (Maybe [Natural]))
-> (Maybe [Natural] -> f (Maybe [Natural]))
-> ProtectiveEquipmentSummary
-> f ProtectiveEquipmentSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Natural] [Natural] [Natural] [Natural]
-> Iso
     (Maybe [Natural])
     (Maybe [Natural])
     (Maybe [Natural])
     (Maybe [Natural])
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 AnIso [Natural] [Natural] [Natural] [Natural]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ProtectiveEquipmentSummary where
  parseJSON :: Value -> Parser ProtectiveEquipmentSummary
parseJSON =
    String
-> (Object -> Parser ProtectiveEquipmentSummary)
-> Value
-> Parser ProtectiveEquipmentSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProtectiveEquipmentSummary"
      ( \Object
x ->
          Maybe [Natural]
-> Maybe [Natural] -> Maybe [Natural] -> ProtectiveEquipmentSummary
ProtectiveEquipmentSummary'
            (Maybe [Natural]
 -> Maybe [Natural]
 -> Maybe [Natural]
 -> ProtectiveEquipmentSummary)
-> Parser (Maybe [Natural])
-> Parser
     (Maybe [Natural] -> Maybe [Natural] -> ProtectiveEquipmentSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Natural]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PersonsWithRequiredEquipment"
                            Parser (Maybe (Maybe [Natural]))
-> Maybe [Natural] -> Parser (Maybe [Natural])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Natural]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [Natural] -> Maybe [Natural] -> ProtectiveEquipmentSummary)
-> Parser (Maybe [Natural])
-> Parser (Maybe [Natural] -> ProtectiveEquipmentSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Natural]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PersonsWithoutRequiredEquipment"
                            Parser (Maybe (Maybe [Natural]))
-> Maybe [Natural] -> Parser (Maybe [Natural])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Natural]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe [Natural] -> ProtectiveEquipmentSummary)
-> Parser (Maybe [Natural]) -> Parser ProtectiveEquipmentSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Natural]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PersonsIndeterminate"
                            Parser (Maybe (Maybe [Natural]))
-> Maybe [Natural] -> Parser (Maybe [Natural])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Natural]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ProtectiveEquipmentSummary

instance Prelude.NFData ProtectiveEquipmentSummary