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

-- | Information about a detected celebrity and the time the celebrity was
-- detected in a stored video. For more information, see
-- GetCelebrityRecognition in the Amazon Rekognition Developer Guide.
--
-- /See:/ 'newCelebrityRecognition' smart constructor.
data CelebrityRecognition = CelebrityRecognition'
  { -- | Information about a recognized celebrity.
    CelebrityRecognition -> Maybe CelebrityDetail
celebrity :: Prelude.Maybe CelebrityDetail,
    -- | The time, in milliseconds from the start of the video, that the
    -- celebrity was recognized. Note that @Timestamp@ is not guaranteed to be
    -- accurate to the individual frame where the celebrity first appears.
    CelebrityRecognition -> Maybe Integer
timestamp :: Prelude.Maybe Prelude.Integer
  }
  deriving (CelebrityRecognition -> CelebrityRecognition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CelebrityRecognition -> CelebrityRecognition -> Bool
$c/= :: CelebrityRecognition -> CelebrityRecognition -> Bool
== :: CelebrityRecognition -> CelebrityRecognition -> Bool
$c== :: CelebrityRecognition -> CelebrityRecognition -> Bool
Prelude.Eq, ReadPrec [CelebrityRecognition]
ReadPrec CelebrityRecognition
Int -> ReadS CelebrityRecognition
ReadS [CelebrityRecognition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CelebrityRecognition]
$creadListPrec :: ReadPrec [CelebrityRecognition]
readPrec :: ReadPrec CelebrityRecognition
$creadPrec :: ReadPrec CelebrityRecognition
readList :: ReadS [CelebrityRecognition]
$creadList :: ReadS [CelebrityRecognition]
readsPrec :: Int -> ReadS CelebrityRecognition
$creadsPrec :: Int -> ReadS CelebrityRecognition
Prelude.Read, Int -> CelebrityRecognition -> ShowS
[CelebrityRecognition] -> ShowS
CelebrityRecognition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CelebrityRecognition] -> ShowS
$cshowList :: [CelebrityRecognition] -> ShowS
show :: CelebrityRecognition -> String
$cshow :: CelebrityRecognition -> String
showsPrec :: Int -> CelebrityRecognition -> ShowS
$cshowsPrec :: Int -> CelebrityRecognition -> ShowS
Prelude.Show, forall x. Rep CelebrityRecognition x -> CelebrityRecognition
forall x. CelebrityRecognition -> Rep CelebrityRecognition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CelebrityRecognition x -> CelebrityRecognition
$cfrom :: forall x. CelebrityRecognition -> Rep CelebrityRecognition x
Prelude.Generic)

-- |
-- Create a value of 'CelebrityRecognition' 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:
--
-- 'celebrity', 'celebrityRecognition_celebrity' - Information about a recognized celebrity.
--
-- 'timestamp', 'celebrityRecognition_timestamp' - The time, in milliseconds from the start of the video, that the
-- celebrity was recognized. Note that @Timestamp@ is not guaranteed to be
-- accurate to the individual frame where the celebrity first appears.
newCelebrityRecognition ::
  CelebrityRecognition
newCelebrityRecognition :: CelebrityRecognition
newCelebrityRecognition =
  CelebrityRecognition'
    { $sel:celebrity:CelebrityRecognition' :: Maybe CelebrityDetail
celebrity = forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:CelebrityRecognition' :: Maybe Integer
timestamp = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about a recognized celebrity.
celebrityRecognition_celebrity :: Lens.Lens' CelebrityRecognition (Prelude.Maybe CelebrityDetail)
celebrityRecognition_celebrity :: Lens' CelebrityRecognition (Maybe CelebrityDetail)
celebrityRecognition_celebrity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CelebrityRecognition' {Maybe CelebrityDetail
celebrity :: Maybe CelebrityDetail
$sel:celebrity:CelebrityRecognition' :: CelebrityRecognition -> Maybe CelebrityDetail
celebrity} -> Maybe CelebrityDetail
celebrity) (\s :: CelebrityRecognition
s@CelebrityRecognition' {} Maybe CelebrityDetail
a -> CelebrityRecognition
s {$sel:celebrity:CelebrityRecognition' :: Maybe CelebrityDetail
celebrity = Maybe CelebrityDetail
a} :: CelebrityRecognition)

-- | The time, in milliseconds from the start of the video, that the
-- celebrity was recognized. Note that @Timestamp@ is not guaranteed to be
-- accurate to the individual frame where the celebrity first appears.
celebrityRecognition_timestamp :: Lens.Lens' CelebrityRecognition (Prelude.Maybe Prelude.Integer)
celebrityRecognition_timestamp :: Lens' CelebrityRecognition (Maybe Integer)
celebrityRecognition_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CelebrityRecognition' {Maybe Integer
timestamp :: Maybe Integer
$sel:timestamp:CelebrityRecognition' :: CelebrityRecognition -> Maybe Integer
timestamp} -> Maybe Integer
timestamp) (\s :: CelebrityRecognition
s@CelebrityRecognition' {} Maybe Integer
a -> CelebrityRecognition
s {$sel:timestamp:CelebrityRecognition' :: Maybe Integer
timestamp = Maybe Integer
a} :: CelebrityRecognition)

instance Data.FromJSON CelebrityRecognition where
  parseJSON :: Value -> Parser CelebrityRecognition
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CelebrityRecognition"
      ( \Object
x ->
          Maybe CelebrityDetail -> Maybe Integer -> CelebrityRecognition
CelebrityRecognition'
            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
"Celebrity")
            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
"Timestamp")
      )

instance Prelude.Hashable CelebrityRecognition where
  hashWithSalt :: Int -> CelebrityRecognition -> Int
hashWithSalt Int
_salt CelebrityRecognition' {Maybe Integer
Maybe CelebrityDetail
timestamp :: Maybe Integer
celebrity :: Maybe CelebrityDetail
$sel:timestamp:CelebrityRecognition' :: CelebrityRecognition -> Maybe Integer
$sel:celebrity:CelebrityRecognition' :: CelebrityRecognition -> Maybe CelebrityDetail
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CelebrityDetail
celebrity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
timestamp

instance Prelude.NFData CelebrityRecognition where
  rnf :: CelebrityRecognition -> ()
rnf CelebrityRecognition' {Maybe Integer
Maybe CelebrityDetail
timestamp :: Maybe Integer
celebrity :: Maybe CelebrityDetail
$sel:timestamp:CelebrityRecognition' :: CelebrityRecognition -> Maybe Integer
$sel:celebrity:CelebrityRecognition' :: CelebrityRecognition -> Maybe CelebrityDetail
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CelebrityDetail
celebrity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
timestamp