{-# 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.PersonDetail
-- 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.PersonDetail 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.FaceDetail

-- | Details about a person detected in a video analysis request.
--
-- /See:/ 'newPersonDetail' smart constructor.
data PersonDetail = PersonDetail'
  { -- | Bounding box around the detected person.
    PersonDetail -> Maybe BoundingBox
boundingBox :: Prelude.Maybe BoundingBox,
    -- | Identifier for the person detected person within a video. Use to keep
    -- track of the person throughout the video. The identifier is not stored
    -- by Amazon Rekognition.
    PersonDetail -> Maybe Integer
index :: Prelude.Maybe Prelude.Integer,
    -- | Face details for the detected person.
    PersonDetail -> Maybe FaceDetail
face :: Prelude.Maybe FaceDetail
  }
  deriving (PersonDetail -> PersonDetail -> Bool
(PersonDetail -> PersonDetail -> Bool)
-> (PersonDetail -> PersonDetail -> Bool) -> Eq PersonDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PersonDetail -> PersonDetail -> Bool
$c/= :: PersonDetail -> PersonDetail -> Bool
== :: PersonDetail -> PersonDetail -> Bool
$c== :: PersonDetail -> PersonDetail -> Bool
Prelude.Eq, ReadPrec [PersonDetail]
ReadPrec PersonDetail
Int -> ReadS PersonDetail
ReadS [PersonDetail]
(Int -> ReadS PersonDetail)
-> ReadS [PersonDetail]
-> ReadPrec PersonDetail
-> ReadPrec [PersonDetail]
-> Read PersonDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PersonDetail]
$creadListPrec :: ReadPrec [PersonDetail]
readPrec :: ReadPrec PersonDetail
$creadPrec :: ReadPrec PersonDetail
readList :: ReadS [PersonDetail]
$creadList :: ReadS [PersonDetail]
readsPrec :: Int -> ReadS PersonDetail
$creadsPrec :: Int -> ReadS PersonDetail
Prelude.Read, Int -> PersonDetail -> ShowS
[PersonDetail] -> ShowS
PersonDetail -> String
(Int -> PersonDetail -> ShowS)
-> (PersonDetail -> String)
-> ([PersonDetail] -> ShowS)
-> Show PersonDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PersonDetail] -> ShowS
$cshowList :: [PersonDetail] -> ShowS
show :: PersonDetail -> String
$cshow :: PersonDetail -> String
showsPrec :: Int -> PersonDetail -> ShowS
$cshowsPrec :: Int -> PersonDetail -> ShowS
Prelude.Show, (forall x. PersonDetail -> Rep PersonDetail x)
-> (forall x. Rep PersonDetail x -> PersonDetail)
-> Generic PersonDetail
forall x. Rep PersonDetail x -> PersonDetail
forall x. PersonDetail -> Rep PersonDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PersonDetail x -> PersonDetail
$cfrom :: forall x. PersonDetail -> Rep PersonDetail x
Prelude.Generic)

-- |
-- Create a value of 'PersonDetail' 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', 'personDetail_boundingBox' - Bounding box around the detected person.
--
-- 'index', 'personDetail_index' - Identifier for the person detected person within a video. Use to keep
-- track of the person throughout the video. The identifier is not stored
-- by Amazon Rekognition.
--
-- 'face', 'personDetail_face' - Face details for the detected person.
newPersonDetail ::
  PersonDetail
newPersonDetail :: PersonDetail
newPersonDetail =
  PersonDetail' :: Maybe BoundingBox
-> Maybe Integer -> Maybe FaceDetail -> PersonDetail
PersonDetail'
    { $sel:boundingBox:PersonDetail' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
forall a. Maybe a
Prelude.Nothing,
      $sel:index:PersonDetail' :: Maybe Integer
index = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:face:PersonDetail' :: Maybe FaceDetail
face = Maybe FaceDetail
forall a. Maybe a
Prelude.Nothing
    }

-- | Bounding box around the detected person.
personDetail_boundingBox :: Lens.Lens' PersonDetail (Prelude.Maybe BoundingBox)
personDetail_boundingBox :: (Maybe BoundingBox -> f (Maybe BoundingBox))
-> PersonDetail -> f PersonDetail
personDetail_boundingBox = (PersonDetail -> Maybe BoundingBox)
-> (PersonDetail -> Maybe BoundingBox -> PersonDetail)
-> Lens
     PersonDetail PersonDetail (Maybe BoundingBox) (Maybe BoundingBox)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PersonDetail' {Maybe BoundingBox
boundingBox :: Maybe BoundingBox
$sel:boundingBox:PersonDetail' :: PersonDetail -> Maybe BoundingBox
boundingBox} -> Maybe BoundingBox
boundingBox) (\s :: PersonDetail
s@PersonDetail' {} Maybe BoundingBox
a -> PersonDetail
s {$sel:boundingBox:PersonDetail' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
a} :: PersonDetail)

-- | Identifier for the person detected person within a video. Use to keep
-- track of the person throughout the video. The identifier is not stored
-- by Amazon Rekognition.
personDetail_index :: Lens.Lens' PersonDetail (Prelude.Maybe Prelude.Integer)
personDetail_index :: (Maybe Integer -> f (Maybe Integer))
-> PersonDetail -> f PersonDetail
personDetail_index = (PersonDetail -> Maybe Integer)
-> (PersonDetail -> Maybe Integer -> PersonDetail)
-> Lens PersonDetail PersonDetail (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PersonDetail' {Maybe Integer
index :: Maybe Integer
$sel:index:PersonDetail' :: PersonDetail -> Maybe Integer
index} -> Maybe Integer
index) (\s :: PersonDetail
s@PersonDetail' {} Maybe Integer
a -> PersonDetail
s {$sel:index:PersonDetail' :: Maybe Integer
index = Maybe Integer
a} :: PersonDetail)

-- | Face details for the detected person.
personDetail_face :: Lens.Lens' PersonDetail (Prelude.Maybe FaceDetail)
personDetail_face :: (Maybe FaceDetail -> f (Maybe FaceDetail))
-> PersonDetail -> f PersonDetail
personDetail_face = (PersonDetail -> Maybe FaceDetail)
-> (PersonDetail -> Maybe FaceDetail -> PersonDetail)
-> Lens
     PersonDetail PersonDetail (Maybe FaceDetail) (Maybe FaceDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PersonDetail' {Maybe FaceDetail
face :: Maybe FaceDetail
$sel:face:PersonDetail' :: PersonDetail -> Maybe FaceDetail
face} -> Maybe FaceDetail
face) (\s :: PersonDetail
s@PersonDetail' {} Maybe FaceDetail
a -> PersonDetail
s {$sel:face:PersonDetail' :: Maybe FaceDetail
face = Maybe FaceDetail
a} :: PersonDetail)

instance Core.FromJSON PersonDetail where
  parseJSON :: Value -> Parser PersonDetail
parseJSON =
    String
-> (Object -> Parser PersonDetail) -> Value -> Parser PersonDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PersonDetail"
      ( \Object
x ->
          Maybe BoundingBox
-> Maybe Integer -> Maybe FaceDetail -> PersonDetail
PersonDetail'
            (Maybe BoundingBox
 -> Maybe Integer -> Maybe FaceDetail -> PersonDetail)
-> Parser (Maybe BoundingBox)
-> Parser (Maybe Integer -> Maybe FaceDetail -> PersonDetail)
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 Integer -> Maybe FaceDetail -> PersonDetail)
-> Parser (Maybe Integer)
-> Parser (Maybe FaceDetail -> PersonDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Index")
            Parser (Maybe FaceDetail -> PersonDetail)
-> Parser (Maybe FaceDetail) -> Parser PersonDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FaceDetail)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Face")
      )

instance Prelude.Hashable PersonDetail

instance Prelude.NFData PersonDetail