{-# 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.ComparedFace
-- 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.ComparedFace 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.Emotion
import Amazonka.Rekognition.Types.ImageQuality
import Amazonka.Rekognition.Types.Landmark
import Amazonka.Rekognition.Types.Pose
import Amazonka.Rekognition.Types.Smile

-- | Provides face metadata for target image faces that are analyzed by
-- @CompareFaces@ and @RecognizeCelebrities@.
--
-- /See:/ 'newComparedFace' smart constructor.
data ComparedFace = ComparedFace'
  { -- | Bounding box of the face.
    ComparedFace -> Maybe BoundingBox
boundingBox :: Prelude.Maybe BoundingBox,
    -- | The emotions that appear to be expressed on the face, and the confidence
    -- level in the determination. Valid values include \"Happy\", \"Sad\",
    -- \"Angry\", \"Confused\", \"Disgusted\", \"Surprised\", \"Calm\",
    -- \"Unknown\", and \"Fear\".
    ComparedFace -> Maybe [Emotion]
emotions :: Prelude.Maybe [Emotion],
    -- | Indicates the pose of the face as determined by its pitch, roll, and
    -- yaw.
    ComparedFace -> Maybe Pose
pose :: Prelude.Maybe Pose,
    -- | Level of confidence that what the bounding box contains is a face.
    ComparedFace -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
    -- | Identifies face image brightness and sharpness.
    ComparedFace -> Maybe ImageQuality
quality :: Prelude.Maybe ImageQuality,
    -- | Indicates whether or not the face is smiling, and the confidence level
    -- in the determination.
    ComparedFace -> Maybe Smile
smile :: Prelude.Maybe Smile,
    -- | An array of facial landmarks.
    ComparedFace -> Maybe [Landmark]
landmarks :: Prelude.Maybe [Landmark]
  }
  deriving (ComparedFace -> ComparedFace -> Bool
(ComparedFace -> ComparedFace -> Bool)
-> (ComparedFace -> ComparedFace -> Bool) -> Eq ComparedFace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComparedFace -> ComparedFace -> Bool
$c/= :: ComparedFace -> ComparedFace -> Bool
== :: ComparedFace -> ComparedFace -> Bool
$c== :: ComparedFace -> ComparedFace -> Bool
Prelude.Eq, ReadPrec [ComparedFace]
ReadPrec ComparedFace
Int -> ReadS ComparedFace
ReadS [ComparedFace]
(Int -> ReadS ComparedFace)
-> ReadS [ComparedFace]
-> ReadPrec ComparedFace
-> ReadPrec [ComparedFace]
-> Read ComparedFace
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComparedFace]
$creadListPrec :: ReadPrec [ComparedFace]
readPrec :: ReadPrec ComparedFace
$creadPrec :: ReadPrec ComparedFace
readList :: ReadS [ComparedFace]
$creadList :: ReadS [ComparedFace]
readsPrec :: Int -> ReadS ComparedFace
$creadsPrec :: Int -> ReadS ComparedFace
Prelude.Read, Int -> ComparedFace -> ShowS
[ComparedFace] -> ShowS
ComparedFace -> String
(Int -> ComparedFace -> ShowS)
-> (ComparedFace -> String)
-> ([ComparedFace] -> ShowS)
-> Show ComparedFace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComparedFace] -> ShowS
$cshowList :: [ComparedFace] -> ShowS
show :: ComparedFace -> String
$cshow :: ComparedFace -> String
showsPrec :: Int -> ComparedFace -> ShowS
$cshowsPrec :: Int -> ComparedFace -> ShowS
Prelude.Show, (forall x. ComparedFace -> Rep ComparedFace x)
-> (forall x. Rep ComparedFace x -> ComparedFace)
-> Generic ComparedFace
forall x. Rep ComparedFace x -> ComparedFace
forall x. ComparedFace -> Rep ComparedFace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComparedFace x -> ComparedFace
$cfrom :: forall x. ComparedFace -> Rep ComparedFace x
Prelude.Generic)

-- |
-- Create a value of 'ComparedFace' 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', 'comparedFace_boundingBox' - Bounding box of the face.
--
-- 'emotions', 'comparedFace_emotions' - The emotions that appear to be expressed on the face, and the confidence
-- level in the determination. Valid values include \"Happy\", \"Sad\",
-- \"Angry\", \"Confused\", \"Disgusted\", \"Surprised\", \"Calm\",
-- \"Unknown\", and \"Fear\".
--
-- 'pose', 'comparedFace_pose' - Indicates the pose of the face as determined by its pitch, roll, and
-- yaw.
--
-- 'confidence', 'comparedFace_confidence' - Level of confidence that what the bounding box contains is a face.
--
-- 'quality', 'comparedFace_quality' - Identifies face image brightness and sharpness.
--
-- 'smile', 'comparedFace_smile' - Indicates whether or not the face is smiling, and the confidence level
-- in the determination.
--
-- 'landmarks', 'comparedFace_landmarks' - An array of facial landmarks.
newComparedFace ::
  ComparedFace
newComparedFace :: ComparedFace
newComparedFace =
  ComparedFace' :: Maybe BoundingBox
-> Maybe [Emotion]
-> Maybe Pose
-> Maybe Double
-> Maybe ImageQuality
-> Maybe Smile
-> Maybe [Landmark]
-> ComparedFace
ComparedFace'
    { $sel:boundingBox:ComparedFace' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
forall a. Maybe a
Prelude.Nothing,
      $sel:emotions:ComparedFace' :: Maybe [Emotion]
emotions = Maybe [Emotion]
forall a. Maybe a
Prelude.Nothing,
      $sel:pose:ComparedFace' :: Maybe Pose
pose = Maybe Pose
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:ComparedFace' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:quality:ComparedFace' :: Maybe ImageQuality
quality = Maybe ImageQuality
forall a. Maybe a
Prelude.Nothing,
      $sel:smile:ComparedFace' :: Maybe Smile
smile = Maybe Smile
forall a. Maybe a
Prelude.Nothing,
      $sel:landmarks:ComparedFace' :: Maybe [Landmark]
landmarks = Maybe [Landmark]
forall a. Maybe a
Prelude.Nothing
    }

-- | Bounding box of the face.
comparedFace_boundingBox :: Lens.Lens' ComparedFace (Prelude.Maybe BoundingBox)
comparedFace_boundingBox :: (Maybe BoundingBox -> f (Maybe BoundingBox))
-> ComparedFace -> f ComparedFace
comparedFace_boundingBox = (ComparedFace -> Maybe BoundingBox)
-> (ComparedFace -> Maybe BoundingBox -> ComparedFace)
-> Lens
     ComparedFace ComparedFace (Maybe BoundingBox) (Maybe BoundingBox)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComparedFace' {Maybe BoundingBox
boundingBox :: Maybe BoundingBox
$sel:boundingBox:ComparedFace' :: ComparedFace -> Maybe BoundingBox
boundingBox} -> Maybe BoundingBox
boundingBox) (\s :: ComparedFace
s@ComparedFace' {} Maybe BoundingBox
a -> ComparedFace
s {$sel:boundingBox:ComparedFace' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
a} :: ComparedFace)

-- | The emotions that appear to be expressed on the face, and the confidence
-- level in the determination. Valid values include \"Happy\", \"Sad\",
-- \"Angry\", \"Confused\", \"Disgusted\", \"Surprised\", \"Calm\",
-- \"Unknown\", and \"Fear\".
comparedFace_emotions :: Lens.Lens' ComparedFace (Prelude.Maybe [Emotion])
comparedFace_emotions :: (Maybe [Emotion] -> f (Maybe [Emotion]))
-> ComparedFace -> f ComparedFace
comparedFace_emotions = (ComparedFace -> Maybe [Emotion])
-> (ComparedFace -> Maybe [Emotion] -> ComparedFace)
-> Lens
     ComparedFace ComparedFace (Maybe [Emotion]) (Maybe [Emotion])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComparedFace' {Maybe [Emotion]
emotions :: Maybe [Emotion]
$sel:emotions:ComparedFace' :: ComparedFace -> Maybe [Emotion]
emotions} -> Maybe [Emotion]
emotions) (\s :: ComparedFace
s@ComparedFace' {} Maybe [Emotion]
a -> ComparedFace
s {$sel:emotions:ComparedFace' :: Maybe [Emotion]
emotions = Maybe [Emotion]
a} :: ComparedFace) ((Maybe [Emotion] -> f (Maybe [Emotion]))
 -> ComparedFace -> f ComparedFace)
-> ((Maybe [Emotion] -> f (Maybe [Emotion]))
    -> Maybe [Emotion] -> f (Maybe [Emotion]))
-> (Maybe [Emotion] -> f (Maybe [Emotion]))
-> ComparedFace
-> f ComparedFace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Emotion] [Emotion] [Emotion] [Emotion]
-> Iso
     (Maybe [Emotion])
     (Maybe [Emotion])
     (Maybe [Emotion])
     (Maybe [Emotion])
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 [Emotion] [Emotion] [Emotion] [Emotion]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Indicates the pose of the face as determined by its pitch, roll, and
-- yaw.
comparedFace_pose :: Lens.Lens' ComparedFace (Prelude.Maybe Pose)
comparedFace_pose :: (Maybe Pose -> f (Maybe Pose)) -> ComparedFace -> f ComparedFace
comparedFace_pose = (ComparedFace -> Maybe Pose)
-> (ComparedFace -> Maybe Pose -> ComparedFace)
-> Lens ComparedFace ComparedFace (Maybe Pose) (Maybe Pose)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComparedFace' {Maybe Pose
pose :: Maybe Pose
$sel:pose:ComparedFace' :: ComparedFace -> Maybe Pose
pose} -> Maybe Pose
pose) (\s :: ComparedFace
s@ComparedFace' {} Maybe Pose
a -> ComparedFace
s {$sel:pose:ComparedFace' :: Maybe Pose
pose = Maybe Pose
a} :: ComparedFace)

-- | Level of confidence that what the bounding box contains is a face.
comparedFace_confidence :: Lens.Lens' ComparedFace (Prelude.Maybe Prelude.Double)
comparedFace_confidence :: (Maybe Double -> f (Maybe Double))
-> ComparedFace -> f ComparedFace
comparedFace_confidence = (ComparedFace -> Maybe Double)
-> (ComparedFace -> Maybe Double -> ComparedFace)
-> Lens ComparedFace ComparedFace (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComparedFace' {Maybe Double
confidence :: Maybe Double
$sel:confidence:ComparedFace' :: ComparedFace -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: ComparedFace
s@ComparedFace' {} Maybe Double
a -> ComparedFace
s {$sel:confidence:ComparedFace' :: Maybe Double
confidence = Maybe Double
a} :: ComparedFace)

-- | Identifies face image brightness and sharpness.
comparedFace_quality :: Lens.Lens' ComparedFace (Prelude.Maybe ImageQuality)
comparedFace_quality :: (Maybe ImageQuality -> f (Maybe ImageQuality))
-> ComparedFace -> f ComparedFace
comparedFace_quality = (ComparedFace -> Maybe ImageQuality)
-> (ComparedFace -> Maybe ImageQuality -> ComparedFace)
-> Lens
     ComparedFace ComparedFace (Maybe ImageQuality) (Maybe ImageQuality)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComparedFace' {Maybe ImageQuality
quality :: Maybe ImageQuality
$sel:quality:ComparedFace' :: ComparedFace -> Maybe ImageQuality
quality} -> Maybe ImageQuality
quality) (\s :: ComparedFace
s@ComparedFace' {} Maybe ImageQuality
a -> ComparedFace
s {$sel:quality:ComparedFace' :: Maybe ImageQuality
quality = Maybe ImageQuality
a} :: ComparedFace)

-- | Indicates whether or not the face is smiling, and the confidence level
-- in the determination.
comparedFace_smile :: Lens.Lens' ComparedFace (Prelude.Maybe Smile)
comparedFace_smile :: (Maybe Smile -> f (Maybe Smile)) -> ComparedFace -> f ComparedFace
comparedFace_smile = (ComparedFace -> Maybe Smile)
-> (ComparedFace -> Maybe Smile -> ComparedFace)
-> Lens ComparedFace ComparedFace (Maybe Smile) (Maybe Smile)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComparedFace' {Maybe Smile
smile :: Maybe Smile
$sel:smile:ComparedFace' :: ComparedFace -> Maybe Smile
smile} -> Maybe Smile
smile) (\s :: ComparedFace
s@ComparedFace' {} Maybe Smile
a -> ComparedFace
s {$sel:smile:ComparedFace' :: Maybe Smile
smile = Maybe Smile
a} :: ComparedFace)

-- | An array of facial landmarks.
comparedFace_landmarks :: Lens.Lens' ComparedFace (Prelude.Maybe [Landmark])
comparedFace_landmarks :: (Maybe [Landmark] -> f (Maybe [Landmark]))
-> ComparedFace -> f ComparedFace
comparedFace_landmarks = (ComparedFace -> Maybe [Landmark])
-> (ComparedFace -> Maybe [Landmark] -> ComparedFace)
-> Lens
     ComparedFace ComparedFace (Maybe [Landmark]) (Maybe [Landmark])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComparedFace' {Maybe [Landmark]
landmarks :: Maybe [Landmark]
$sel:landmarks:ComparedFace' :: ComparedFace -> Maybe [Landmark]
landmarks} -> Maybe [Landmark]
landmarks) (\s :: ComparedFace
s@ComparedFace' {} Maybe [Landmark]
a -> ComparedFace
s {$sel:landmarks:ComparedFace' :: Maybe [Landmark]
landmarks = Maybe [Landmark]
a} :: ComparedFace) ((Maybe [Landmark] -> f (Maybe [Landmark]))
 -> ComparedFace -> f ComparedFace)
-> ((Maybe [Landmark] -> f (Maybe [Landmark]))
    -> Maybe [Landmark] -> f (Maybe [Landmark]))
-> (Maybe [Landmark] -> f (Maybe [Landmark]))
-> ComparedFace
-> f ComparedFace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Landmark] [Landmark] [Landmark] [Landmark]
-> Iso
     (Maybe [Landmark])
     (Maybe [Landmark])
     (Maybe [Landmark])
     (Maybe [Landmark])
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 [Landmark] [Landmark] [Landmark] [Landmark]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ComparedFace where
  parseJSON :: Value -> Parser ComparedFace
parseJSON =
    String
-> (Object -> Parser ComparedFace) -> Value -> Parser ComparedFace
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ComparedFace"
      ( \Object
x ->
          Maybe BoundingBox
-> Maybe [Emotion]
-> Maybe Pose
-> Maybe Double
-> Maybe ImageQuality
-> Maybe Smile
-> Maybe [Landmark]
-> ComparedFace
ComparedFace'
            (Maybe BoundingBox
 -> Maybe [Emotion]
 -> Maybe Pose
 -> Maybe Double
 -> Maybe ImageQuality
 -> Maybe Smile
 -> Maybe [Landmark]
 -> ComparedFace)
-> Parser (Maybe BoundingBox)
-> Parser
     (Maybe [Emotion]
      -> Maybe Pose
      -> Maybe Double
      -> Maybe ImageQuality
      -> Maybe Smile
      -> Maybe [Landmark]
      -> ComparedFace)
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 [Emotion]
   -> Maybe Pose
   -> Maybe Double
   -> Maybe ImageQuality
   -> Maybe Smile
   -> Maybe [Landmark]
   -> ComparedFace)
-> Parser (Maybe [Emotion])
-> Parser
     (Maybe Pose
      -> Maybe Double
      -> Maybe ImageQuality
      -> Maybe Smile
      -> Maybe [Landmark]
      -> ComparedFace)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Emotion]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Emotions" Parser (Maybe (Maybe [Emotion]))
-> Maybe [Emotion] -> Parser (Maybe [Emotion])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Emotion]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Pose
   -> Maybe Double
   -> Maybe ImageQuality
   -> Maybe Smile
   -> Maybe [Landmark]
   -> ComparedFace)
-> Parser (Maybe Pose)
-> Parser
     (Maybe Double
      -> Maybe ImageQuality
      -> Maybe Smile
      -> Maybe [Landmark]
      -> ComparedFace)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Pose)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Pose")
            Parser
  (Maybe Double
   -> Maybe ImageQuality
   -> Maybe Smile
   -> Maybe [Landmark]
   -> ComparedFace)
-> Parser (Maybe Double)
-> Parser
     (Maybe ImageQuality
      -> Maybe Smile -> Maybe [Landmark] -> ComparedFace)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Confidence")
            Parser
  (Maybe ImageQuality
   -> Maybe Smile -> Maybe [Landmark] -> ComparedFace)
-> Parser (Maybe ImageQuality)
-> Parser (Maybe Smile -> Maybe [Landmark] -> ComparedFace)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ImageQuality)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Quality")
            Parser (Maybe Smile -> Maybe [Landmark] -> ComparedFace)
-> Parser (Maybe Smile)
-> Parser (Maybe [Landmark] -> ComparedFace)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Smile)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Smile")
            Parser (Maybe [Landmark] -> ComparedFace)
-> Parser (Maybe [Landmark]) -> Parser ComparedFace
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Landmark]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Landmarks" Parser (Maybe (Maybe [Landmark]))
-> Maybe [Landmark] -> Parser (Maybe [Landmark])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Landmark]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ComparedFace

instance Prelude.NFData ComparedFace