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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | 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],
    -- | The structure that contains attributes of a face that
    -- @IndexFaces@detected, but didn\'t index.
    UnindexedFace -> Maybe FaceDetail
faceDetail :: Prelude.Maybe FaceDetail
  }
  deriving (UnindexedFace -> UnindexedFace -> Bool
(UnindexedFace -> UnindexedFace -> Bool)
-> (UnindexedFace -> UnindexedFace -> Bool) -> Eq UnindexedFace
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]
(Int -> ReadS UnindexedFace)
-> ReadS [UnindexedFace]
-> ReadPrec UnindexedFace
-> ReadPrec [UnindexedFace]
-> Read 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
(Int -> UnindexedFace -> ShowS)
-> (UnindexedFace -> String)
-> ([UnindexedFace] -> ShowS)
-> Show UnindexedFace
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. UnindexedFace -> Rep UnindexedFace x)
-> (forall x. Rep UnindexedFace x -> UnindexedFace)
-> Generic UnindexedFace
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:
--
-- '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.
--
-- 'faceDetail', 'unindexedFace_faceDetail' - The structure that contains attributes of a face that
-- @IndexFaces@detected, but didn\'t index.
newUnindexedFace ::
  UnindexedFace
newUnindexedFace :: UnindexedFace
newUnindexedFace =
  UnindexedFace' :: Maybe [Reason] -> Maybe FaceDetail -> UnindexedFace
UnindexedFace'
    { $sel:reasons:UnindexedFace' :: Maybe [Reason]
reasons = Maybe [Reason]
forall a. Maybe a
Prelude.Nothing,
      $sel:faceDetail:UnindexedFace' :: Maybe FaceDetail
faceDetail = Maybe FaceDetail
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe [Reason] -> f (Maybe [Reason]))
-> UnindexedFace -> f UnindexedFace
unindexedFace_reasons = (UnindexedFace -> Maybe [Reason])
-> (UnindexedFace -> Maybe [Reason] -> UnindexedFace)
-> Lens
     UnindexedFace UnindexedFace (Maybe [Reason]) (Maybe [Reason])
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) ((Maybe [Reason] -> f (Maybe [Reason]))
 -> UnindexedFace -> f UnindexedFace)
-> ((Maybe [Reason] -> f (Maybe [Reason]))
    -> Maybe [Reason] -> f (Maybe [Reason]))
-> (Maybe [Reason] -> f (Maybe [Reason]))
-> UnindexedFace
-> f UnindexedFace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Reason] [Reason] [Reason] [Reason]
-> Iso
     (Maybe [Reason]) (Maybe [Reason]) (Maybe [Reason]) (Maybe [Reason])
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 [Reason] [Reason] [Reason] [Reason]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe FaceDetail -> f (Maybe FaceDetail))
-> UnindexedFace -> f UnindexedFace
unindexedFace_faceDetail = (UnindexedFace -> Maybe FaceDetail)
-> (UnindexedFace -> Maybe FaceDetail -> UnindexedFace)
-> Lens
     UnindexedFace UnindexedFace (Maybe FaceDetail) (Maybe 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)

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

instance Prelude.Hashable UnindexedFace

instance Prelude.NFData UnindexedFace