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

-- | A face that IndexFaces detected, but didn\'t index. Use the @Reasons@
-- response attribute to determine why a face wasn\'t indexed.
--
-- /See:/ 'newUnindexedFace' smart constructor.
data UnindexedFace = UnindexedFace'
  { -- | The structure that contains attributes of a face that
    -- @IndexFaces@detected, but didn\'t index.
    UnindexedFace -> Maybe FaceDetail
faceDetail :: Prelude.Maybe FaceDetail,
    -- | An array of reasons that specify why a face wasn\'t indexed.
    --
    -- -   EXTREME_POSE - The face is at a pose that can\'t be detected. For
    --     example, the head is turned too far away from the camera.
    --
    -- -   EXCEEDS_MAX_FACES - The number of faces detected is already higher
    --     than that specified by the @MaxFaces@ input parameter for
    --     @IndexFaces@.
    --
    -- -   LOW_BRIGHTNESS - The image is too dark.
    --
    -- -   LOW_SHARPNESS - The image is too blurry.
    --
    -- -   LOW_CONFIDENCE - The face was detected with a low confidence.
    --
    -- -   SMALL_BOUNDING_BOX - The bounding box around the face is too small.
    UnindexedFace -> Maybe [Reason]
reasons :: Prelude.Maybe [Reason]
  }
  deriving (UnindexedFace -> UnindexedFace -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnindexedFace -> UnindexedFace -> Bool
$c/= :: UnindexedFace -> UnindexedFace -> Bool
== :: UnindexedFace -> UnindexedFace -> Bool
$c== :: UnindexedFace -> UnindexedFace -> Bool
Prelude.Eq, ReadPrec [UnindexedFace]
ReadPrec UnindexedFace
Int -> ReadS UnindexedFace
ReadS [UnindexedFace]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnindexedFace]
$creadListPrec :: ReadPrec [UnindexedFace]
readPrec :: ReadPrec UnindexedFace
$creadPrec :: ReadPrec UnindexedFace
readList :: ReadS [UnindexedFace]
$creadList :: ReadS [UnindexedFace]
readsPrec :: Int -> ReadS UnindexedFace
$creadsPrec :: Int -> ReadS UnindexedFace
Prelude.Read, Int -> UnindexedFace -> ShowS
[UnindexedFace] -> ShowS
UnindexedFace -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnindexedFace] -> ShowS
$cshowList :: [UnindexedFace] -> ShowS
show :: UnindexedFace -> String
$cshow :: UnindexedFace -> String
showsPrec :: Int -> UnindexedFace -> ShowS
$cshowsPrec :: Int -> UnindexedFace -> ShowS
Prelude.Show, forall x. Rep UnindexedFace x -> UnindexedFace
forall x. UnindexedFace -> Rep UnindexedFace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnindexedFace x -> UnindexedFace
$cfrom :: forall x. UnindexedFace -> Rep UnindexedFace x
Prelude.Generic)

-- |
-- Create a value of 'UnindexedFace' 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:
--
-- 'faceDetail', 'unindexedFace_faceDetail' - The structure that contains attributes of a face that
-- @IndexFaces@detected, but didn\'t index.
--
-- 'reasons', 'unindexedFace_reasons' - An array of reasons that specify why a face wasn\'t indexed.
--
-- -   EXTREME_POSE - The face is at a pose that can\'t be detected. For
--     example, the head is turned too far away from the camera.
--
-- -   EXCEEDS_MAX_FACES - The number of faces detected is already higher
--     than that specified by the @MaxFaces@ input parameter for
--     @IndexFaces@.
--
-- -   LOW_BRIGHTNESS - The image is too dark.
--
-- -   LOW_SHARPNESS - The image is too blurry.
--
-- -   LOW_CONFIDENCE - The face was detected with a low confidence.
--
-- -   SMALL_BOUNDING_BOX - The bounding box around the face is too small.
newUnindexedFace ::
  UnindexedFace
newUnindexedFace :: UnindexedFace
newUnindexedFace =
  UnindexedFace'
    { $sel:faceDetail:UnindexedFace' :: Maybe FaceDetail
faceDetail = forall a. Maybe a
Prelude.Nothing,
      $sel:reasons:UnindexedFace' :: Maybe [Reason]
reasons = forall a. Maybe a
Prelude.Nothing
    }

-- | The structure that contains attributes of a face that
-- @IndexFaces@detected, but didn\'t index.
unindexedFace_faceDetail :: Lens.Lens' UnindexedFace (Prelude.Maybe FaceDetail)
unindexedFace_faceDetail :: Lens' UnindexedFace (Maybe FaceDetail)
unindexedFace_faceDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnindexedFace' {Maybe FaceDetail
faceDetail :: Maybe FaceDetail
$sel:faceDetail:UnindexedFace' :: UnindexedFace -> Maybe FaceDetail
faceDetail} -> Maybe FaceDetail
faceDetail) (\s :: UnindexedFace
s@UnindexedFace' {} Maybe FaceDetail
a -> UnindexedFace
s {$sel:faceDetail:UnindexedFace' :: Maybe FaceDetail
faceDetail = Maybe FaceDetail
a} :: UnindexedFace)

-- | An array of reasons that specify why a face wasn\'t indexed.
--
-- -   EXTREME_POSE - The face is at a pose that can\'t be detected. For
--     example, the head is turned too far away from the camera.
--
-- -   EXCEEDS_MAX_FACES - The number of faces detected is already higher
--     than that specified by the @MaxFaces@ input parameter for
--     @IndexFaces@.
--
-- -   LOW_BRIGHTNESS - The image is too dark.
--
-- -   LOW_SHARPNESS - The image is too blurry.
--
-- -   LOW_CONFIDENCE - The face was detected with a low confidence.
--
-- -   SMALL_BOUNDING_BOX - The bounding box around the face is too small.
unindexedFace_reasons :: Lens.Lens' UnindexedFace (Prelude.Maybe [Reason])
unindexedFace_reasons :: Lens' UnindexedFace (Maybe [Reason])
unindexedFace_reasons = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnindexedFace' {Maybe [Reason]
reasons :: Maybe [Reason]
$sel:reasons:UnindexedFace' :: UnindexedFace -> Maybe [Reason]
reasons} -> Maybe [Reason]
reasons) (\s :: UnindexedFace
s@UnindexedFace' {} Maybe [Reason]
a -> UnindexedFace
s {$sel:reasons:UnindexedFace' :: Maybe [Reason]
reasons = Maybe [Reason]
a} :: UnindexedFace) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON UnindexedFace where
  parseJSON :: Value -> Parser UnindexedFace
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UnindexedFace"
      ( \Object
x ->
          Maybe FaceDetail -> Maybe [Reason] -> UnindexedFace
UnindexedFace'
            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
"FaceDetail")
            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
"Reasons" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable UnindexedFace where
  hashWithSalt :: Int -> UnindexedFace -> Int
hashWithSalt Int
_salt UnindexedFace' {Maybe [Reason]
Maybe FaceDetail
reasons :: Maybe [Reason]
faceDetail :: Maybe FaceDetail
$sel:reasons:UnindexedFace' :: UnindexedFace -> Maybe [Reason]
$sel:faceDetail:UnindexedFace' :: UnindexedFace -> Maybe FaceDetail
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FaceDetail
faceDetail
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Reason]
reasons

instance Prelude.NFData UnindexedFace where
  rnf :: UnindexedFace -> ()
rnf UnindexedFace' {Maybe [Reason]
Maybe FaceDetail
reasons :: Maybe [Reason]
faceDetail :: Maybe FaceDetail
$sel:reasons:UnindexedFace' :: UnindexedFace -> Maybe [Reason]
$sel:faceDetail:UnindexedFace' :: UnindexedFace -> Maybe FaceDetail
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FaceDetail
faceDetail
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Reason]
reasons