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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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.
    CelebrityRecognition -> Maybe Integer
timestamp :: Prelude.Maybe Prelude.Integer
  }
  deriving (CelebrityRecognition -> CelebrityRecognition -> Bool
(CelebrityRecognition -> CelebrityRecognition -> Bool)
-> (CelebrityRecognition -> CelebrityRecognition -> Bool)
-> Eq CelebrityRecognition
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]
(Int -> ReadS CelebrityRecognition)
-> ReadS [CelebrityRecognition]
-> ReadPrec CelebrityRecognition
-> ReadPrec [CelebrityRecognition]
-> Read 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
(Int -> CelebrityRecognition -> ShowS)
-> (CelebrityRecognition -> String)
-> ([CelebrityRecognition] -> ShowS)
-> Show CelebrityRecognition
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. CelebrityRecognition -> Rep CelebrityRecognition x)
-> (forall x. Rep CelebrityRecognition x -> CelebrityRecognition)
-> Generic CelebrityRecognition
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.
newCelebrityRecognition ::
  CelebrityRecognition
newCelebrityRecognition :: CelebrityRecognition
newCelebrityRecognition =
  CelebrityRecognition' :: Maybe CelebrityDetail -> Maybe Integer -> CelebrityRecognition
CelebrityRecognition'
    { $sel:celebrity:CelebrityRecognition' :: Maybe CelebrityDetail
celebrity = Maybe CelebrityDetail
forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:CelebrityRecognition' :: Maybe Integer
timestamp = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about a recognized celebrity.
celebrityRecognition_celebrity :: Lens.Lens' CelebrityRecognition (Prelude.Maybe CelebrityDetail)
celebrityRecognition_celebrity :: (Maybe CelebrityDetail -> f (Maybe CelebrityDetail))
-> CelebrityRecognition -> f CelebrityRecognition
celebrityRecognition_celebrity = (CelebrityRecognition -> Maybe CelebrityDetail)
-> (CelebrityRecognition
    -> Maybe CelebrityDetail -> CelebrityRecognition)
-> Lens
     CelebrityRecognition
     CelebrityRecognition
     (Maybe CelebrityDetail)
     (Maybe CelebrityDetail)
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.
celebrityRecognition_timestamp :: Lens.Lens' CelebrityRecognition (Prelude.Maybe Prelude.Integer)
celebrityRecognition_timestamp :: (Maybe Integer -> f (Maybe Integer))
-> CelebrityRecognition -> f CelebrityRecognition
celebrityRecognition_timestamp = (CelebrityRecognition -> Maybe Integer)
-> (CelebrityRecognition -> Maybe Integer -> CelebrityRecognition)
-> Lens
     CelebrityRecognition
     CelebrityRecognition
     (Maybe Integer)
     (Maybe Integer)
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 Core.FromJSON CelebrityRecognition where
  parseJSON :: Value -> Parser CelebrityRecognition
parseJSON =
    String
-> (Object -> Parser CelebrityRecognition)
-> Value
-> Parser CelebrityRecognition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CelebrityRecognition"
      ( \Object
x ->
          Maybe CelebrityDetail -> Maybe Integer -> CelebrityRecognition
CelebrityRecognition'
            (Maybe CelebrityDetail -> Maybe Integer -> CelebrityRecognition)
-> Parser (Maybe CelebrityDetail)
-> Parser (Maybe Integer -> CelebrityRecognition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CelebrityDetail)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Celebrity")
            Parser (Maybe Integer -> CelebrityRecognition)
-> Parser (Maybe Integer) -> Parser CelebrityRecognition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Timestamp")
      )

instance Prelude.Hashable CelebrityRecognition

instance Prelude.NFData CelebrityRecognition