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

-- | Provides information about a single type of inappropriate, unwanted, or
-- offensive content found in an image or video. Each type of moderated
-- content has a label within a hierarchical taxonomy. For more
-- information, see Content moderation in the Amazon Rekognition Developer
-- Guide.
--
-- /See:/ 'newModerationLabel' smart constructor.
data ModerationLabel = ModerationLabel'
  { -- | Specifies the confidence that Amazon Rekognition has that the label has
    -- been correctly identified.
    --
    -- If you don\'t specify the @MinConfidence@ parameter in the call to
    -- @DetectModerationLabels@, the operation returns labels with a confidence
    -- value greater than or equal to 50 percent.
    ModerationLabel -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
    -- | The label name for the type of unsafe content detected in the image.
    ModerationLabel -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The name for the parent label. Labels at the top level of the hierarchy
    -- have the parent label @\"\"@.
    ModerationLabel -> Maybe Text
parentName :: Prelude.Maybe Prelude.Text
  }
  deriving (ModerationLabel -> ModerationLabel -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModerationLabel -> ModerationLabel -> Bool
$c/= :: ModerationLabel -> ModerationLabel -> Bool
== :: ModerationLabel -> ModerationLabel -> Bool
$c== :: ModerationLabel -> ModerationLabel -> Bool
Prelude.Eq, ReadPrec [ModerationLabel]
ReadPrec ModerationLabel
Int -> ReadS ModerationLabel
ReadS [ModerationLabel]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModerationLabel]
$creadListPrec :: ReadPrec [ModerationLabel]
readPrec :: ReadPrec ModerationLabel
$creadPrec :: ReadPrec ModerationLabel
readList :: ReadS [ModerationLabel]
$creadList :: ReadS [ModerationLabel]
readsPrec :: Int -> ReadS ModerationLabel
$creadsPrec :: Int -> ReadS ModerationLabel
Prelude.Read, Int -> ModerationLabel -> ShowS
[ModerationLabel] -> ShowS
ModerationLabel -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModerationLabel] -> ShowS
$cshowList :: [ModerationLabel] -> ShowS
show :: ModerationLabel -> String
$cshow :: ModerationLabel -> String
showsPrec :: Int -> ModerationLabel -> ShowS
$cshowsPrec :: Int -> ModerationLabel -> ShowS
Prelude.Show, forall x. Rep ModerationLabel x -> ModerationLabel
forall x. ModerationLabel -> Rep ModerationLabel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModerationLabel x -> ModerationLabel
$cfrom :: forall x. ModerationLabel -> Rep ModerationLabel x
Prelude.Generic)

-- |
-- Create a value of 'ModerationLabel' 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:
--
-- 'confidence', 'moderationLabel_confidence' - Specifies the confidence that Amazon Rekognition has that the label has
-- been correctly identified.
--
-- If you don\'t specify the @MinConfidence@ parameter in the call to
-- @DetectModerationLabels@, the operation returns labels with a confidence
-- value greater than or equal to 50 percent.
--
-- 'name', 'moderationLabel_name' - The label name for the type of unsafe content detected in the image.
--
-- 'parentName', 'moderationLabel_parentName' - The name for the parent label. Labels at the top level of the hierarchy
-- have the parent label @\"\"@.
newModerationLabel ::
  ModerationLabel
newModerationLabel :: ModerationLabel
newModerationLabel =
  ModerationLabel'
    { $sel:confidence:ModerationLabel' :: Maybe Double
confidence = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ModerationLabel' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:parentName:ModerationLabel' :: Maybe Text
parentName = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the confidence that Amazon Rekognition has that the label has
-- been correctly identified.
--
-- If you don\'t specify the @MinConfidence@ parameter in the call to
-- @DetectModerationLabels@, the operation returns labels with a confidence
-- value greater than or equal to 50 percent.
moderationLabel_confidence :: Lens.Lens' ModerationLabel (Prelude.Maybe Prelude.Double)
moderationLabel_confidence :: Lens' ModerationLabel (Maybe Double)
moderationLabel_confidence = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModerationLabel' {Maybe Double
confidence :: Maybe Double
$sel:confidence:ModerationLabel' :: ModerationLabel -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: ModerationLabel
s@ModerationLabel' {} Maybe Double
a -> ModerationLabel
s {$sel:confidence:ModerationLabel' :: Maybe Double
confidence = Maybe Double
a} :: ModerationLabel)

-- | The label name for the type of unsafe content detected in the image.
moderationLabel_name :: Lens.Lens' ModerationLabel (Prelude.Maybe Prelude.Text)
moderationLabel_name :: Lens' ModerationLabel (Maybe Text)
moderationLabel_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModerationLabel' {Maybe Text
name :: Maybe Text
$sel:name:ModerationLabel' :: ModerationLabel -> Maybe Text
name} -> Maybe Text
name) (\s :: ModerationLabel
s@ModerationLabel' {} Maybe Text
a -> ModerationLabel
s {$sel:name:ModerationLabel' :: Maybe Text
name = Maybe Text
a} :: ModerationLabel)

-- | The name for the parent label. Labels at the top level of the hierarchy
-- have the parent label @\"\"@.
moderationLabel_parentName :: Lens.Lens' ModerationLabel (Prelude.Maybe Prelude.Text)
moderationLabel_parentName :: Lens' ModerationLabel (Maybe Text)
moderationLabel_parentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModerationLabel' {Maybe Text
parentName :: Maybe Text
$sel:parentName:ModerationLabel' :: ModerationLabel -> Maybe Text
parentName} -> Maybe Text
parentName) (\s :: ModerationLabel
s@ModerationLabel' {} Maybe Text
a -> ModerationLabel
s {$sel:parentName:ModerationLabel' :: Maybe Text
parentName = Maybe Text
a} :: ModerationLabel)

instance Data.FromJSON ModerationLabel where
  parseJSON :: Value -> Parser ModerationLabel
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ModerationLabel"
      ( \Object
x ->
          Maybe Double -> Maybe Text -> Maybe Text -> ModerationLabel
ModerationLabel'
            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
"Confidence")
            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
"ParentName")
      )

instance Prelude.Hashable ModerationLabel where
  hashWithSalt :: Int -> ModerationLabel -> Int
hashWithSalt Int
_salt ModerationLabel' {Maybe Double
Maybe Text
parentName :: Maybe Text
name :: Maybe Text
confidence :: Maybe Double
$sel:parentName:ModerationLabel' :: ModerationLabel -> Maybe Text
$sel:name:ModerationLabel' :: ModerationLabel -> Maybe Text
$sel:confidence:ModerationLabel' :: ModerationLabel -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
confidence
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
parentName

instance Prelude.NFData ModerationLabel where
  rnf :: ModerationLabel -> ()
rnf ModerationLabel' {Maybe Double
Maybe Text
parentName :: Maybe Text
name :: Maybe Text
confidence :: Maybe Double
$sel:parentName:ModerationLabel' :: ModerationLabel -> Maybe Text
$sel:name:ModerationLabel' :: ModerationLabel -> Maybe Text
$sel:confidence:ModerationLabel' :: ModerationLabel -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
confidence
      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
parentName