{-# 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.FaceRecord
-- 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.FaceRecord 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.Face
import Amazonka.Rekognition.Types.FaceDetail

-- | Object containing both the face metadata (stored in the backend
-- database), and facial attributes that are detected but aren\'t stored in
-- the database.
--
-- /See:/ 'newFaceRecord' smart constructor.
data FaceRecord = FaceRecord'
  { -- | Describes the face properties such as the bounding box, face ID, image
    -- ID of the input image, and external image ID that you assigned.
    FaceRecord -> Maybe Face
face :: Prelude.Maybe Face,
    -- | Structure containing attributes of the face that the algorithm detected.
    FaceRecord -> Maybe FaceDetail
faceDetail :: Prelude.Maybe FaceDetail
  }
  deriving (FaceRecord -> FaceRecord -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FaceRecord -> FaceRecord -> Bool
$c/= :: FaceRecord -> FaceRecord -> Bool
== :: FaceRecord -> FaceRecord -> Bool
$c== :: FaceRecord -> FaceRecord -> Bool
Prelude.Eq, ReadPrec [FaceRecord]
ReadPrec FaceRecord
Int -> ReadS FaceRecord
ReadS [FaceRecord]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FaceRecord]
$creadListPrec :: ReadPrec [FaceRecord]
readPrec :: ReadPrec FaceRecord
$creadPrec :: ReadPrec FaceRecord
readList :: ReadS [FaceRecord]
$creadList :: ReadS [FaceRecord]
readsPrec :: Int -> ReadS FaceRecord
$creadsPrec :: Int -> ReadS FaceRecord
Prelude.Read, Int -> FaceRecord -> ShowS
[FaceRecord] -> ShowS
FaceRecord -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FaceRecord] -> ShowS
$cshowList :: [FaceRecord] -> ShowS
show :: FaceRecord -> String
$cshow :: FaceRecord -> String
showsPrec :: Int -> FaceRecord -> ShowS
$cshowsPrec :: Int -> FaceRecord -> ShowS
Prelude.Show, forall x. Rep FaceRecord x -> FaceRecord
forall x. FaceRecord -> Rep FaceRecord x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FaceRecord x -> FaceRecord
$cfrom :: forall x. FaceRecord -> Rep FaceRecord x
Prelude.Generic)

-- |
-- Create a value of 'FaceRecord' 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:
--
-- 'face', 'faceRecord_face' - Describes the face properties such as the bounding box, face ID, image
-- ID of the input image, and external image ID that you assigned.
--
-- 'faceDetail', 'faceRecord_faceDetail' - Structure containing attributes of the face that the algorithm detected.
newFaceRecord ::
  FaceRecord
newFaceRecord :: FaceRecord
newFaceRecord =
  FaceRecord'
    { $sel:face:FaceRecord' :: Maybe Face
face = forall a. Maybe a
Prelude.Nothing,
      $sel:faceDetail:FaceRecord' :: Maybe FaceDetail
faceDetail = forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the face properties such as the bounding box, face ID, image
-- ID of the input image, and external image ID that you assigned.
faceRecord_face :: Lens.Lens' FaceRecord (Prelude.Maybe Face)
faceRecord_face :: Lens' FaceRecord (Maybe Face)
faceRecord_face = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FaceRecord' {Maybe Face
face :: Maybe Face
$sel:face:FaceRecord' :: FaceRecord -> Maybe Face
face} -> Maybe Face
face) (\s :: FaceRecord
s@FaceRecord' {} Maybe Face
a -> FaceRecord
s {$sel:face:FaceRecord' :: Maybe Face
face = Maybe Face
a} :: FaceRecord)

-- | Structure containing attributes of the face that the algorithm detected.
faceRecord_faceDetail :: Lens.Lens' FaceRecord (Prelude.Maybe FaceDetail)
faceRecord_faceDetail :: Lens' FaceRecord (Maybe FaceDetail)
faceRecord_faceDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FaceRecord' {Maybe FaceDetail
faceDetail :: Maybe FaceDetail
$sel:faceDetail:FaceRecord' :: FaceRecord -> Maybe FaceDetail
faceDetail} -> Maybe FaceDetail
faceDetail) (\s :: FaceRecord
s@FaceRecord' {} Maybe FaceDetail
a -> FaceRecord
s {$sel:faceDetail:FaceRecord' :: Maybe FaceDetail
faceDetail = Maybe FaceDetail
a} :: FaceRecord)

instance Data.FromJSON FaceRecord where
  parseJSON :: Value -> Parser FaceRecord
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FaceRecord"
      ( \Object
x ->
          Maybe Face -> Maybe FaceDetail -> FaceRecord
FaceRecord'
            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
"Face")
            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
"FaceDetail")
      )

instance Prelude.Hashable FaceRecord where
  hashWithSalt :: Int -> FaceRecord -> Int
hashWithSalt Int
_salt FaceRecord' {Maybe Face
Maybe FaceDetail
faceDetail :: Maybe FaceDetail
face :: Maybe Face
$sel:faceDetail:FaceRecord' :: FaceRecord -> Maybe FaceDetail
$sel:face:FaceRecord' :: FaceRecord -> Maybe Face
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Face
face
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FaceDetail
faceDetail

instance Prelude.NFData FaceRecord where
  rnf :: FaceRecord -> ()
rnf FaceRecord' {Maybe Face
Maybe FaceDetail
faceDetail :: Maybe FaceDetail
face :: Maybe Face
$sel:faceDetail:FaceRecord' :: FaceRecord -> Maybe FaceDetail
$sel:face:FaceRecord' :: FaceRecord -> Maybe Face
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Face
face
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FaceDetail
faceDetail