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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ComparedSourceImageFace -> ComparedSourceImageFace -> Bool)
-> (ComparedSourceImageFace -> ComparedSourceImageFace -> Bool)
-> Eq ComparedSourceImageFace
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]
(Int -> ReadS ComparedSourceImageFace)
-> ReadS [ComparedSourceImageFace]
-> ReadPrec ComparedSourceImageFace
-> ReadPrec [ComparedSourceImageFace]
-> Read 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
(Int -> ComparedSourceImageFace -> ShowS)
-> (ComparedSourceImageFace -> String)
-> ([ComparedSourceImageFace] -> ShowS)
-> Show ComparedSourceImageFace
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.
 ComparedSourceImageFace -> Rep ComparedSourceImageFace x)
-> (forall x.
    Rep ComparedSourceImageFace x -> ComparedSourceImageFace)
-> Generic ComparedSourceImageFace
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' :: Maybe BoundingBox -> Maybe Double -> ComparedSourceImageFace
ComparedSourceImageFace'
    { $sel:boundingBox:ComparedSourceImageFace' :: Maybe BoundingBox
boundingBox =
        Maybe BoundingBox
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:ComparedSourceImageFace' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | Bounding box of the face.
comparedSourceImageFace_boundingBox :: Lens.Lens' ComparedSourceImageFace (Prelude.Maybe BoundingBox)
comparedSourceImageFace_boundingBox :: (Maybe BoundingBox -> f (Maybe BoundingBox))
-> ComparedSourceImageFace -> f ComparedSourceImageFace
comparedSourceImageFace_boundingBox = (ComparedSourceImageFace -> Maybe BoundingBox)
-> (ComparedSourceImageFace
    -> Maybe BoundingBox -> ComparedSourceImageFace)
-> Lens
     ComparedSourceImageFace
     ComparedSourceImageFace
     (Maybe BoundingBox)
     (Maybe 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 :: (Maybe Double -> f (Maybe Double))
-> ComparedSourceImageFace -> f ComparedSourceImageFace
comparedSourceImageFace_confidence = (ComparedSourceImageFace -> Maybe Double)
-> (ComparedSourceImageFace
    -> Maybe Double -> ComparedSourceImageFace)
-> Lens
     ComparedSourceImageFace
     ComparedSourceImageFace
     (Maybe Double)
     (Maybe Double)
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 Core.FromJSON ComparedSourceImageFace where
  parseJSON :: Value -> Parser ComparedSourceImageFace
parseJSON =
    String
-> (Object -> Parser ComparedSourceImageFace)
-> Value
-> Parser ComparedSourceImageFace
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ComparedSourceImageFace"
      ( \Object
x ->
          Maybe BoundingBox -> Maybe Double -> ComparedSourceImageFace
ComparedSourceImageFace'
            (Maybe BoundingBox -> Maybe Double -> ComparedSourceImageFace)
-> Parser (Maybe BoundingBox)
-> Parser (Maybe Double -> ComparedSourceImageFace)
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 Double -> ComparedSourceImageFace)
-> Parser (Maybe Double) -> Parser ComparedSourceImageFace
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")
      )

instance Prelude.Hashable ComparedSourceImageFace

instance Prelude.NFData ComparedSourceImageFace