{-# 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.ComparedSourceImageFace
-- 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.ComparedSourceImageFace 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.BoundingBox

-- | Type that describes the face Amazon Rekognition chose to compare with
-- the faces in the target. This contains a bounding box for the selected
-- face and confidence level that the bounding box contains a face. Note
-- that Amazon Rekognition selects the largest face in the source image for
-- this comparison.
--
-- /See:/ 'newComparedSourceImageFace' smart constructor.
data ComparedSourceImageFace = ComparedSourceImageFace'
  { -- | Bounding box of the face.
    ComparedSourceImageFace -> Maybe BoundingBox
boundingBox :: Prelude.Maybe BoundingBox,
    -- | Confidence level that the selected bounding box contains a face.
    ComparedSourceImageFace -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double
  }
  deriving (ComparedSourceImageFace -> ComparedSourceImageFace -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComparedSourceImageFace -> ComparedSourceImageFace -> Bool
$c/= :: ComparedSourceImageFace -> ComparedSourceImageFace -> Bool
== :: ComparedSourceImageFace -> ComparedSourceImageFace -> Bool
$c== :: ComparedSourceImageFace -> ComparedSourceImageFace -> Bool
Prelude.Eq, ReadPrec [ComparedSourceImageFace]
ReadPrec ComparedSourceImageFace
Int -> ReadS ComparedSourceImageFace
ReadS [ComparedSourceImageFace]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComparedSourceImageFace]
$creadListPrec :: ReadPrec [ComparedSourceImageFace]
readPrec :: ReadPrec ComparedSourceImageFace
$creadPrec :: ReadPrec ComparedSourceImageFace
readList :: ReadS [ComparedSourceImageFace]
$creadList :: ReadS [ComparedSourceImageFace]
readsPrec :: Int -> ReadS ComparedSourceImageFace
$creadsPrec :: Int -> ReadS ComparedSourceImageFace
Prelude.Read, Int -> ComparedSourceImageFace -> ShowS
[ComparedSourceImageFace] -> ShowS
ComparedSourceImageFace -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComparedSourceImageFace] -> ShowS
$cshowList :: [ComparedSourceImageFace] -> ShowS
show :: ComparedSourceImageFace -> String
$cshow :: ComparedSourceImageFace -> String
showsPrec :: Int -> ComparedSourceImageFace -> ShowS
$cshowsPrec :: Int -> ComparedSourceImageFace -> ShowS
Prelude.Show, forall x. Rep ComparedSourceImageFace x -> ComparedSourceImageFace
forall x. ComparedSourceImageFace -> Rep ComparedSourceImageFace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComparedSourceImageFace x -> ComparedSourceImageFace
$cfrom :: forall x. ComparedSourceImageFace -> Rep ComparedSourceImageFace x
Prelude.Generic)

-- |
-- Create a value of 'ComparedSourceImageFace' 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', 'comparedSourceImageFace_boundingBox' - Bounding box of the face.
--
-- 'confidence', 'comparedSourceImageFace_confidence' - Confidence level that the selected bounding box contains a face.
newComparedSourceImageFace ::
  ComparedSourceImageFace
newComparedSourceImageFace :: ComparedSourceImageFace
newComparedSourceImageFace =
  ComparedSourceImageFace'
    { $sel:boundingBox:ComparedSourceImageFace' :: Maybe BoundingBox
boundingBox =
        forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:ComparedSourceImageFace' :: Maybe Double
confidence = forall a. Maybe a
Prelude.Nothing
    }

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

-- | Confidence level that the selected bounding box contains a face.
comparedSourceImageFace_confidence :: Lens.Lens' ComparedSourceImageFace (Prelude.Maybe Prelude.Double)
comparedSourceImageFace_confidence :: Lens' ComparedSourceImageFace (Maybe Double)
comparedSourceImageFace_confidence = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComparedSourceImageFace' {Maybe Double
confidence :: Maybe Double
$sel:confidence:ComparedSourceImageFace' :: ComparedSourceImageFace -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: ComparedSourceImageFace
s@ComparedSourceImageFace' {} Maybe Double
a -> ComparedSourceImageFace
s {$sel:confidence:ComparedSourceImageFace' :: Maybe Double
confidence = Maybe Double
a} :: ComparedSourceImageFace)

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

instance Prelude.Hashable ComparedSourceImageFace where
  hashWithSalt :: Int -> ComparedSourceImageFace -> Int
hashWithSalt Int
_salt ComparedSourceImageFace' {Maybe Double
Maybe BoundingBox
confidence :: Maybe Double
boundingBox :: Maybe BoundingBox
$sel:confidence:ComparedSourceImageFace' :: ComparedSourceImageFace -> Maybe Double
$sel:boundingBox:ComparedSourceImageFace' :: ComparedSourceImageFace -> Maybe BoundingBox
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BoundingBox
boundingBox
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
confidence

instance Prelude.NFData ComparedSourceImageFace where
  rnf :: ComparedSourceImageFace -> ()
rnf ComparedSourceImageFace' {Maybe Double
Maybe BoundingBox
confidence :: Maybe Double
boundingBox :: Maybe BoundingBox
$sel:confidence:ComparedSourceImageFace' :: ComparedSourceImageFace -> Maybe Double
$sel:boundingBox:ComparedSourceImageFace' :: ComparedSourceImageFace -> Maybe BoundingBox
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe BoundingBox
boundingBox
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
confidence