{-# 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.Celebrity
-- 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.Celebrity 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.ComparedFace
import Amazonka.Rekognition.Types.KnownGender

-- | Provides information about a celebrity recognized by the
-- RecognizeCelebrities operation.
--
-- /See:/ 'newCelebrity' smart constructor.
data Celebrity = Celebrity'
  { -- | Provides information about the celebrity\'s face, such as its location
    -- on the image.
    Celebrity -> Maybe ComparedFace
face :: Prelude.Maybe ComparedFace,
    -- | A unique identifier for the celebrity.
    Celebrity -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    Celebrity -> Maybe KnownGender
knownGender :: Prelude.Maybe KnownGender,
    -- | The confidence, in percentage, that Amazon Rekognition has that the
    -- recognized face is the celebrity.
    Celebrity -> Maybe Double
matchConfidence :: Prelude.Maybe Prelude.Double,
    -- | The name of the celebrity.
    Celebrity -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | An array of URLs pointing to additional information about the celebrity.
    -- If there is no additional information about the celebrity, this list is
    -- empty.
    Celebrity -> Maybe [Text]
urls :: Prelude.Maybe [Prelude.Text]
  }
  deriving (Celebrity -> Celebrity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Celebrity -> Celebrity -> Bool
$c/= :: Celebrity -> Celebrity -> Bool
== :: Celebrity -> Celebrity -> Bool
$c== :: Celebrity -> Celebrity -> Bool
Prelude.Eq, ReadPrec [Celebrity]
ReadPrec Celebrity
Int -> ReadS Celebrity
ReadS [Celebrity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Celebrity]
$creadListPrec :: ReadPrec [Celebrity]
readPrec :: ReadPrec Celebrity
$creadPrec :: ReadPrec Celebrity
readList :: ReadS [Celebrity]
$creadList :: ReadS [Celebrity]
readsPrec :: Int -> ReadS Celebrity
$creadsPrec :: Int -> ReadS Celebrity
Prelude.Read, Int -> Celebrity -> ShowS
[Celebrity] -> ShowS
Celebrity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Celebrity] -> ShowS
$cshowList :: [Celebrity] -> ShowS
show :: Celebrity -> String
$cshow :: Celebrity -> String
showsPrec :: Int -> Celebrity -> ShowS
$cshowsPrec :: Int -> Celebrity -> ShowS
Prelude.Show, forall x. Rep Celebrity x -> Celebrity
forall x. Celebrity -> Rep Celebrity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Celebrity x -> Celebrity
$cfrom :: forall x. Celebrity -> Rep Celebrity x
Prelude.Generic)

-- |
-- Create a value of 'Celebrity' 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:
--
-- 'face', 'celebrity_face' - Provides information about the celebrity\'s face, such as its location
-- on the image.
--
-- 'id', 'celebrity_id' - A unique identifier for the celebrity.
--
-- 'knownGender', 'celebrity_knownGender' - Undocumented member.
--
-- 'matchConfidence', 'celebrity_matchConfidence' - The confidence, in percentage, that Amazon Rekognition has that the
-- recognized face is the celebrity.
--
-- 'name', 'celebrity_name' - The name of the celebrity.
--
-- 'urls', 'celebrity_urls' - An array of URLs pointing to additional information about the celebrity.
-- If there is no additional information about the celebrity, this list is
-- empty.
newCelebrity ::
  Celebrity
newCelebrity :: Celebrity
newCelebrity =
  Celebrity'
    { $sel:face:Celebrity' :: Maybe ComparedFace
face = forall a. Maybe a
Prelude.Nothing,
      $sel:id:Celebrity' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:knownGender:Celebrity' :: Maybe KnownGender
knownGender = forall a. Maybe a
Prelude.Nothing,
      $sel:matchConfidence:Celebrity' :: Maybe Double
matchConfidence = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Celebrity' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:urls:Celebrity' :: Maybe [Text]
urls = forall a. Maybe a
Prelude.Nothing
    }

-- | Provides information about the celebrity\'s face, such as its location
-- on the image.
celebrity_face :: Lens.Lens' Celebrity (Prelude.Maybe ComparedFace)
celebrity_face :: Lens' Celebrity (Maybe ComparedFace)
celebrity_face = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Celebrity' {Maybe ComparedFace
face :: Maybe ComparedFace
$sel:face:Celebrity' :: Celebrity -> Maybe ComparedFace
face} -> Maybe ComparedFace
face) (\s :: Celebrity
s@Celebrity' {} Maybe ComparedFace
a -> Celebrity
s {$sel:face:Celebrity' :: Maybe ComparedFace
face = Maybe ComparedFace
a} :: Celebrity)

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

-- | Undocumented member.
celebrity_knownGender :: Lens.Lens' Celebrity (Prelude.Maybe KnownGender)
celebrity_knownGender :: Lens' Celebrity (Maybe KnownGender)
celebrity_knownGender = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Celebrity' {Maybe KnownGender
knownGender :: Maybe KnownGender
$sel:knownGender:Celebrity' :: Celebrity -> Maybe KnownGender
knownGender} -> Maybe KnownGender
knownGender) (\s :: Celebrity
s@Celebrity' {} Maybe KnownGender
a -> Celebrity
s {$sel:knownGender:Celebrity' :: Maybe KnownGender
knownGender = Maybe KnownGender
a} :: Celebrity)

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

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

-- | An array of URLs pointing to additional information about the celebrity.
-- If there is no additional information about the celebrity, this list is
-- empty.
celebrity_urls :: Lens.Lens' Celebrity (Prelude.Maybe [Prelude.Text])
celebrity_urls :: Lens' Celebrity (Maybe [Text])
celebrity_urls = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Celebrity' {Maybe [Text]
urls :: Maybe [Text]
$sel:urls:Celebrity' :: Celebrity -> Maybe [Text]
urls} -> Maybe [Text]
urls) (\s :: Celebrity
s@Celebrity' {} Maybe [Text]
a -> Celebrity
s {$sel:urls:Celebrity' :: Maybe [Text]
urls = Maybe [Text]
a} :: Celebrity) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON Celebrity where
  parseJSON :: Value -> Parser Celebrity
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Celebrity"
      ( \Object
x ->
          Maybe ComparedFace
-> Maybe Text
-> Maybe KnownGender
-> Maybe Double
-> Maybe Text
-> Maybe [Text]
-> Celebrity
Celebrity'
            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
"Face")
            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
"Id")
            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
"KnownGender")
            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
"MatchConfidence")
            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
"Name")
            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
"Urls" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Celebrity where
  hashWithSalt :: Int -> Celebrity -> Int
hashWithSalt Int
_salt Celebrity' {Maybe Double
Maybe [Text]
Maybe Text
Maybe KnownGender
Maybe ComparedFace
urls :: Maybe [Text]
name :: Maybe Text
matchConfidence :: Maybe Double
knownGender :: Maybe KnownGender
id :: Maybe Text
face :: Maybe ComparedFace
$sel:urls:Celebrity' :: Celebrity -> Maybe [Text]
$sel:name:Celebrity' :: Celebrity -> Maybe Text
$sel:matchConfidence:Celebrity' :: Celebrity -> Maybe Double
$sel:knownGender:Celebrity' :: Celebrity -> Maybe KnownGender
$sel:id:Celebrity' :: Celebrity -> Maybe Text
$sel:face:Celebrity' :: Celebrity -> Maybe ComparedFace
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ComparedFace
face
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KnownGender
knownGender
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
matchConfidence
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
urls

instance Prelude.NFData Celebrity where
  rnf :: Celebrity -> ()
rnf Celebrity' {Maybe Double
Maybe [Text]
Maybe Text
Maybe KnownGender
Maybe ComparedFace
urls :: Maybe [Text]
name :: Maybe Text
matchConfidence :: Maybe Double
knownGender :: Maybe KnownGender
id :: Maybe Text
face :: Maybe ComparedFace
$sel:urls:Celebrity' :: Celebrity -> Maybe [Text]
$sel:name:Celebrity' :: Celebrity -> Maybe Text
$sel:matchConfidence:Celebrity' :: Celebrity -> Maybe Double
$sel:knownGender:Celebrity' :: Celebrity -> Maybe KnownGender
$sel:id:Celebrity' :: Celebrity -> Maybe Text
$sel:face:Celebrity' :: Celebrity -> Maybe ComparedFace
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ComparedFace
face
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe KnownGender
knownGender
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
matchConfidence
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
urls