{-# 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.CelebrityDetail
-- 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.CelebrityDetail 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.FaceDetail

-- | Information about a recognized celebrity.
--
-- /See:/ 'newCelebrityDetail' smart constructor.
data CelebrityDetail = CelebrityDetail'
  { -- | Bounding box around the body of a celebrity.
    CelebrityDetail -> Maybe BoundingBox
boundingBox :: Prelude.Maybe BoundingBox,
    -- | An array of URLs pointing to additional celebrity information.
    CelebrityDetail -> Maybe [Text]
urls :: Prelude.Maybe [Prelude.Text],
    -- | The confidence, in percentage, that Amazon Rekognition has that the
    -- recognized face is the celebrity.
    CelebrityDetail -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
    -- | The name of the celebrity.
    CelebrityDetail -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the celebrity.
    CelebrityDetail -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | Face details for the recognized celebrity.
    CelebrityDetail -> Maybe FaceDetail
face :: Prelude.Maybe FaceDetail
  }
  deriving (CelebrityDetail -> CelebrityDetail -> Bool
(CelebrityDetail -> CelebrityDetail -> Bool)
-> (CelebrityDetail -> CelebrityDetail -> Bool)
-> Eq CelebrityDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CelebrityDetail -> CelebrityDetail -> Bool
$c/= :: CelebrityDetail -> CelebrityDetail -> Bool
== :: CelebrityDetail -> CelebrityDetail -> Bool
$c== :: CelebrityDetail -> CelebrityDetail -> Bool
Prelude.Eq, ReadPrec [CelebrityDetail]
ReadPrec CelebrityDetail
Int -> ReadS CelebrityDetail
ReadS [CelebrityDetail]
(Int -> ReadS CelebrityDetail)
-> ReadS [CelebrityDetail]
-> ReadPrec CelebrityDetail
-> ReadPrec [CelebrityDetail]
-> Read CelebrityDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CelebrityDetail]
$creadListPrec :: ReadPrec [CelebrityDetail]
readPrec :: ReadPrec CelebrityDetail
$creadPrec :: ReadPrec CelebrityDetail
readList :: ReadS [CelebrityDetail]
$creadList :: ReadS [CelebrityDetail]
readsPrec :: Int -> ReadS CelebrityDetail
$creadsPrec :: Int -> ReadS CelebrityDetail
Prelude.Read, Int -> CelebrityDetail -> ShowS
[CelebrityDetail] -> ShowS
CelebrityDetail -> String
(Int -> CelebrityDetail -> ShowS)
-> (CelebrityDetail -> String)
-> ([CelebrityDetail] -> ShowS)
-> Show CelebrityDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CelebrityDetail] -> ShowS
$cshowList :: [CelebrityDetail] -> ShowS
show :: CelebrityDetail -> String
$cshow :: CelebrityDetail -> String
showsPrec :: Int -> CelebrityDetail -> ShowS
$cshowsPrec :: Int -> CelebrityDetail -> ShowS
Prelude.Show, (forall x. CelebrityDetail -> Rep CelebrityDetail x)
-> (forall x. Rep CelebrityDetail x -> CelebrityDetail)
-> Generic CelebrityDetail
forall x. Rep CelebrityDetail x -> CelebrityDetail
forall x. CelebrityDetail -> Rep CelebrityDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CelebrityDetail x -> CelebrityDetail
$cfrom :: forall x. CelebrityDetail -> Rep CelebrityDetail x
Prelude.Generic)

-- |
-- Create a value of 'CelebrityDetail' 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', 'celebrityDetail_boundingBox' - Bounding box around the body of a celebrity.
--
-- 'urls', 'celebrityDetail_urls' - An array of URLs pointing to additional celebrity information.
--
-- 'confidence', 'celebrityDetail_confidence' - The confidence, in percentage, that Amazon Rekognition has that the
-- recognized face is the celebrity.
--
-- 'name', 'celebrityDetail_name' - The name of the celebrity.
--
-- 'id', 'celebrityDetail_id' - The unique identifier for the celebrity.
--
-- 'face', 'celebrityDetail_face' - Face details for the recognized celebrity.
newCelebrityDetail ::
  CelebrityDetail
newCelebrityDetail :: CelebrityDetail
newCelebrityDetail =
  CelebrityDetail' :: Maybe BoundingBox
-> Maybe [Text]
-> Maybe Double
-> Maybe Text
-> Maybe Text
-> Maybe FaceDetail
-> CelebrityDetail
CelebrityDetail'
    { $sel:boundingBox:CelebrityDetail' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
forall a. Maybe a
Prelude.Nothing,
      $sel:urls:CelebrityDetail' :: Maybe [Text]
urls = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:CelebrityDetail' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CelebrityDetail' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:CelebrityDetail' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:face:CelebrityDetail' :: Maybe FaceDetail
face = Maybe FaceDetail
forall a. Maybe a
Prelude.Nothing
    }

-- | Bounding box around the body of a celebrity.
celebrityDetail_boundingBox :: Lens.Lens' CelebrityDetail (Prelude.Maybe BoundingBox)
celebrityDetail_boundingBox :: (Maybe BoundingBox -> f (Maybe BoundingBox))
-> CelebrityDetail -> f CelebrityDetail
celebrityDetail_boundingBox = (CelebrityDetail -> Maybe BoundingBox)
-> (CelebrityDetail -> Maybe BoundingBox -> CelebrityDetail)
-> Lens
     CelebrityDetail
     CelebrityDetail
     (Maybe BoundingBox)
     (Maybe BoundingBox)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CelebrityDetail' {Maybe BoundingBox
boundingBox :: Maybe BoundingBox
$sel:boundingBox:CelebrityDetail' :: CelebrityDetail -> Maybe BoundingBox
boundingBox} -> Maybe BoundingBox
boundingBox) (\s :: CelebrityDetail
s@CelebrityDetail' {} Maybe BoundingBox
a -> CelebrityDetail
s {$sel:boundingBox:CelebrityDetail' :: Maybe BoundingBox
boundingBox = Maybe BoundingBox
a} :: CelebrityDetail)

-- | An array of URLs pointing to additional celebrity information.
celebrityDetail_urls :: Lens.Lens' CelebrityDetail (Prelude.Maybe [Prelude.Text])
celebrityDetail_urls :: (Maybe [Text] -> f (Maybe [Text]))
-> CelebrityDetail -> f CelebrityDetail
celebrityDetail_urls = (CelebrityDetail -> Maybe [Text])
-> (CelebrityDetail -> Maybe [Text] -> CelebrityDetail)
-> Lens
     CelebrityDetail CelebrityDetail (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CelebrityDetail' {Maybe [Text]
urls :: Maybe [Text]
$sel:urls:CelebrityDetail' :: CelebrityDetail -> Maybe [Text]
urls} -> Maybe [Text]
urls) (\s :: CelebrityDetail
s@CelebrityDetail' {} Maybe [Text]
a -> CelebrityDetail
s {$sel:urls:CelebrityDetail' :: Maybe [Text]
urls = Maybe [Text]
a} :: CelebrityDetail) ((Maybe [Text] -> f (Maybe [Text]))
 -> CelebrityDetail -> f CelebrityDetail)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CelebrityDetail
-> f CelebrityDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The confidence, in percentage, that Amazon Rekognition has that the
-- recognized face is the celebrity.
celebrityDetail_confidence :: Lens.Lens' CelebrityDetail (Prelude.Maybe Prelude.Double)
celebrityDetail_confidence :: (Maybe Double -> f (Maybe Double))
-> CelebrityDetail -> f CelebrityDetail
celebrityDetail_confidence = (CelebrityDetail -> Maybe Double)
-> (CelebrityDetail -> Maybe Double -> CelebrityDetail)
-> Lens
     CelebrityDetail CelebrityDetail (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CelebrityDetail' {Maybe Double
confidence :: Maybe Double
$sel:confidence:CelebrityDetail' :: CelebrityDetail -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: CelebrityDetail
s@CelebrityDetail' {} Maybe Double
a -> CelebrityDetail
s {$sel:confidence:CelebrityDetail' :: Maybe Double
confidence = Maybe Double
a} :: CelebrityDetail)

-- | The name of the celebrity.
celebrityDetail_name :: Lens.Lens' CelebrityDetail (Prelude.Maybe Prelude.Text)
celebrityDetail_name :: (Maybe Text -> f (Maybe Text))
-> CelebrityDetail -> f CelebrityDetail
celebrityDetail_name = (CelebrityDetail -> Maybe Text)
-> (CelebrityDetail -> Maybe Text -> CelebrityDetail)
-> Lens CelebrityDetail CelebrityDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CelebrityDetail' {Maybe Text
name :: Maybe Text
$sel:name:CelebrityDetail' :: CelebrityDetail -> Maybe Text
name} -> Maybe Text
name) (\s :: CelebrityDetail
s@CelebrityDetail' {} Maybe Text
a -> CelebrityDetail
s {$sel:name:CelebrityDetail' :: Maybe Text
name = Maybe Text
a} :: CelebrityDetail)

-- | The unique identifier for the celebrity.
celebrityDetail_id :: Lens.Lens' CelebrityDetail (Prelude.Maybe Prelude.Text)
celebrityDetail_id :: (Maybe Text -> f (Maybe Text))
-> CelebrityDetail -> f CelebrityDetail
celebrityDetail_id = (CelebrityDetail -> Maybe Text)
-> (CelebrityDetail -> Maybe Text -> CelebrityDetail)
-> Lens CelebrityDetail CelebrityDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CelebrityDetail' {Maybe Text
id :: Maybe Text
$sel:id:CelebrityDetail' :: CelebrityDetail -> Maybe Text
id} -> Maybe Text
id) (\s :: CelebrityDetail
s@CelebrityDetail' {} Maybe Text
a -> CelebrityDetail
s {$sel:id:CelebrityDetail' :: Maybe Text
id = Maybe Text
a} :: CelebrityDetail)

-- | Face details for the recognized celebrity.
celebrityDetail_face :: Lens.Lens' CelebrityDetail (Prelude.Maybe FaceDetail)
celebrityDetail_face :: (Maybe FaceDetail -> f (Maybe FaceDetail))
-> CelebrityDetail -> f CelebrityDetail
celebrityDetail_face = (CelebrityDetail -> Maybe FaceDetail)
-> (CelebrityDetail -> Maybe FaceDetail -> CelebrityDetail)
-> Lens
     CelebrityDetail
     CelebrityDetail
     (Maybe FaceDetail)
     (Maybe FaceDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CelebrityDetail' {Maybe FaceDetail
face :: Maybe FaceDetail
$sel:face:CelebrityDetail' :: CelebrityDetail -> Maybe FaceDetail
face} -> Maybe FaceDetail
face) (\s :: CelebrityDetail
s@CelebrityDetail' {} Maybe FaceDetail
a -> CelebrityDetail
s {$sel:face:CelebrityDetail' :: Maybe FaceDetail
face = Maybe FaceDetail
a} :: CelebrityDetail)

instance Core.FromJSON CelebrityDetail where
  parseJSON :: Value -> Parser CelebrityDetail
parseJSON =
    String
-> (Object -> Parser CelebrityDetail)
-> Value
-> Parser CelebrityDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CelebrityDetail"
      ( \Object
x ->
          Maybe BoundingBox
-> Maybe [Text]
-> Maybe Double
-> Maybe Text
-> Maybe Text
-> Maybe FaceDetail
-> CelebrityDetail
CelebrityDetail'
            (Maybe BoundingBox
 -> Maybe [Text]
 -> Maybe Double
 -> Maybe Text
 -> Maybe Text
 -> Maybe FaceDetail
 -> CelebrityDetail)
-> Parser (Maybe BoundingBox)
-> Parser
     (Maybe [Text]
      -> Maybe Double
      -> Maybe Text
      -> Maybe Text
      -> Maybe FaceDetail
      -> CelebrityDetail)
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 [Text]
   -> Maybe Double
   -> Maybe Text
   -> Maybe Text
   -> Maybe FaceDetail
   -> CelebrityDetail)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Double
      -> Maybe Text -> Maybe Text -> Maybe FaceDetail -> CelebrityDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Urls" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Double
   -> Maybe Text -> Maybe Text -> Maybe FaceDetail -> CelebrityDetail)
-> Parser (Maybe Double)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe FaceDetail -> CelebrityDetail)
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 Text -> Maybe Text -> Maybe FaceDetail -> CelebrityDetail)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe FaceDetail -> CelebrityDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe Text -> Maybe FaceDetail -> CelebrityDetail)
-> Parser (Maybe Text)
-> Parser (Maybe FaceDetail -> CelebrityDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
            Parser (Maybe FaceDetail -> CelebrityDetail)
-> Parser (Maybe FaceDetail) -> Parser CelebrityDetail
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
"Face")
      )

instance Prelude.Hashable CelebrityDetail

instance Prelude.NFData CelebrityDetail