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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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.
    ContentModerationDetection -> Maybe Integer
timestamp :: Prelude.Maybe Prelude.Integer
  }
  deriving (ContentModerationDetection -> ContentModerationDetection -> Bool
(ContentModerationDetection -> ContentModerationDetection -> Bool)
-> (ContentModerationDetection
    -> ContentModerationDetection -> Bool)
-> Eq ContentModerationDetection
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]
(Int -> ReadS ContentModerationDetection)
-> ReadS [ContentModerationDetection]
-> ReadPrec ContentModerationDetection
-> ReadPrec [ContentModerationDetection]
-> Read 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
(Int -> ContentModerationDetection -> ShowS)
-> (ContentModerationDetection -> String)
-> ([ContentModerationDetection] -> ShowS)
-> Show ContentModerationDetection
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.
 ContentModerationDetection -> Rep ContentModerationDetection x)
-> (forall x.
    Rep ContentModerationDetection x -> ContentModerationDetection)
-> Generic ContentModerationDetection
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.
newContentModerationDetection ::
  ContentModerationDetection
newContentModerationDetection :: ContentModerationDetection
newContentModerationDetection =
  ContentModerationDetection' :: Maybe ModerationLabel
-> Maybe Integer -> ContentModerationDetection
ContentModerationDetection'
    { $sel:moderationLabel:ContentModerationDetection' :: Maybe ModerationLabel
moderationLabel =
        Maybe ModerationLabel
forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:ContentModerationDetection' :: Maybe Integer
timestamp = Maybe Integer
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 :: (Maybe ModerationLabel -> f (Maybe ModerationLabel))
-> ContentModerationDetection -> f ContentModerationDetection
contentModerationDetection_moderationLabel = (ContentModerationDetection -> Maybe ModerationLabel)
-> (ContentModerationDetection
    -> Maybe ModerationLabel -> ContentModerationDetection)
-> Lens
     ContentModerationDetection
     ContentModerationDetection
     (Maybe ModerationLabel)
     (Maybe 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.
contentModerationDetection_timestamp :: Lens.Lens' ContentModerationDetection (Prelude.Maybe Prelude.Integer)
contentModerationDetection_timestamp :: (Maybe Integer -> f (Maybe Integer))
-> ContentModerationDetection -> f ContentModerationDetection
contentModerationDetection_timestamp = (ContentModerationDetection -> Maybe Integer)
-> (ContentModerationDetection
    -> Maybe Integer -> ContentModerationDetection)
-> Lens
     ContentModerationDetection
     ContentModerationDetection
     (Maybe Integer)
     (Maybe Integer)
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 Core.FromJSON ContentModerationDetection where
  parseJSON :: Value -> Parser ContentModerationDetection
parseJSON =
    String
-> (Object -> Parser ContentModerationDetection)
-> Value
-> Parser ContentModerationDetection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContentModerationDetection"
      ( \Object
x ->
          Maybe ModerationLabel
-> Maybe Integer -> ContentModerationDetection
ContentModerationDetection'
            (Maybe ModerationLabel
 -> Maybe Integer -> ContentModerationDetection)
-> Parser (Maybe ModerationLabel)
-> Parser (Maybe Integer -> ContentModerationDetection)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ModerationLabel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ModerationLabel")
            Parser (Maybe Integer -> ContentModerationDetection)
-> Parser (Maybe Integer) -> Parser ContentModerationDetection
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 ContentModerationDetection

instance Prelude.NFData ContentModerationDetection