{-# 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.ContentModerationDetection
-- 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.ContentModerationDetection 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.ModerationLabel

-- | Information about an inappropriate, unwanted, or offensive content label
-- detection in a stored video.
--
-- /See:/ 'newContentModerationDetection' smart constructor.
data ContentModerationDetection = ContentModerationDetection'
  { -- | The content moderation label detected by in the stored video.
    ContentModerationDetection -> Maybe ModerationLabel
moderationLabel :: Prelude.Maybe ModerationLabel,
    -- | Time, in milliseconds from the beginning of the video, that the content
    -- moderation label was detected. Note that @Timestamp@ is not guaranteed
    -- to be accurate to the individual frame where the moderated content first
    -- appears.
    ContentModerationDetection -> Maybe Integer
timestamp :: Prelude.Maybe Prelude.Integer
  }
  deriving (ContentModerationDetection -> ContentModerationDetection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContentModerationDetection -> ContentModerationDetection -> Bool
$c/= :: ContentModerationDetection -> ContentModerationDetection -> Bool
== :: ContentModerationDetection -> ContentModerationDetection -> Bool
$c== :: ContentModerationDetection -> ContentModerationDetection -> Bool
Prelude.Eq, ReadPrec [ContentModerationDetection]
ReadPrec ContentModerationDetection
Int -> ReadS ContentModerationDetection
ReadS [ContentModerationDetection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContentModerationDetection]
$creadListPrec :: ReadPrec [ContentModerationDetection]
readPrec :: ReadPrec ContentModerationDetection
$creadPrec :: ReadPrec ContentModerationDetection
readList :: ReadS [ContentModerationDetection]
$creadList :: ReadS [ContentModerationDetection]
readsPrec :: Int -> ReadS ContentModerationDetection
$creadsPrec :: Int -> ReadS ContentModerationDetection
Prelude.Read, Int -> ContentModerationDetection -> ShowS
[ContentModerationDetection] -> ShowS
ContentModerationDetection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContentModerationDetection] -> ShowS
$cshowList :: [ContentModerationDetection] -> ShowS
show :: ContentModerationDetection -> String
$cshow :: ContentModerationDetection -> String
showsPrec :: Int -> ContentModerationDetection -> ShowS
$cshowsPrec :: Int -> ContentModerationDetection -> ShowS
Prelude.Show, forall x.
Rep ContentModerationDetection x -> ContentModerationDetection
forall x.
ContentModerationDetection -> Rep ContentModerationDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContentModerationDetection x -> ContentModerationDetection
$cfrom :: forall x.
ContentModerationDetection -> Rep ContentModerationDetection x
Prelude.Generic)

-- |
-- Create a value of 'ContentModerationDetection' 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:
--
-- 'moderationLabel', 'contentModerationDetection_moderationLabel' - The content moderation label detected by in the stored video.
--
-- 'timestamp', 'contentModerationDetection_timestamp' - Time, in milliseconds from the beginning of the video, that the content
-- moderation label was detected. Note that @Timestamp@ is not guaranteed
-- to be accurate to the individual frame where the moderated content first
-- appears.
newContentModerationDetection ::
  ContentModerationDetection
newContentModerationDetection :: ContentModerationDetection
newContentModerationDetection =
  ContentModerationDetection'
    { $sel:moderationLabel:ContentModerationDetection' :: Maybe ModerationLabel
moderationLabel =
        forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:ContentModerationDetection' :: Maybe Integer
timestamp = forall a. Maybe a
Prelude.Nothing
    }

-- | The content moderation label detected by in the stored video.
contentModerationDetection_moderationLabel :: Lens.Lens' ContentModerationDetection (Prelude.Maybe ModerationLabel)
contentModerationDetection_moderationLabel :: Lens' ContentModerationDetection (Maybe ModerationLabel)
contentModerationDetection_moderationLabel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentModerationDetection' {Maybe ModerationLabel
moderationLabel :: Maybe ModerationLabel
$sel:moderationLabel:ContentModerationDetection' :: ContentModerationDetection -> Maybe ModerationLabel
moderationLabel} -> Maybe ModerationLabel
moderationLabel) (\s :: ContentModerationDetection
s@ContentModerationDetection' {} Maybe ModerationLabel
a -> ContentModerationDetection
s {$sel:moderationLabel:ContentModerationDetection' :: Maybe ModerationLabel
moderationLabel = Maybe ModerationLabel
a} :: ContentModerationDetection)

-- | Time, in milliseconds from the beginning of the video, that the content
-- moderation label was detected. Note that @Timestamp@ is not guaranteed
-- to be accurate to the individual frame where the moderated content first
-- appears.
contentModerationDetection_timestamp :: Lens.Lens' ContentModerationDetection (Prelude.Maybe Prelude.Integer)
contentModerationDetection_timestamp :: Lens' ContentModerationDetection (Maybe Integer)
contentModerationDetection_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentModerationDetection' {Maybe Integer
timestamp :: Maybe Integer
$sel:timestamp:ContentModerationDetection' :: ContentModerationDetection -> Maybe Integer
timestamp} -> Maybe Integer
timestamp) (\s :: ContentModerationDetection
s@ContentModerationDetection' {} Maybe Integer
a -> ContentModerationDetection
s {$sel:timestamp:ContentModerationDetection' :: Maybe Integer
timestamp = Maybe Integer
a} :: ContentModerationDetection)

instance Data.FromJSON ContentModerationDetection where
  parseJSON :: Value -> Parser ContentModerationDetection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContentModerationDetection"
      ( \Object
x ->
          Maybe ModerationLabel
-> Maybe Integer -> ContentModerationDetection
ContentModerationDetection'
            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
"ModerationLabel")
            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 ContentModerationDetection where
  hashWithSalt :: Int -> ContentModerationDetection -> Int
hashWithSalt Int
_salt ContentModerationDetection' {Maybe Integer
Maybe ModerationLabel
timestamp :: Maybe Integer
moderationLabel :: Maybe ModerationLabel
$sel:timestamp:ContentModerationDetection' :: ContentModerationDetection -> Maybe Integer
$sel:moderationLabel:ContentModerationDetection' :: ContentModerationDetection -> Maybe ModerationLabel
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ModerationLabel
moderationLabel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
timestamp

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