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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ModerationLabel -> ModerationLabel -> Bool)
-> (ModerationLabel -> ModerationLabel -> Bool)
-> Eq ModerationLabel
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]
(Int -> ReadS ModerationLabel)
-> ReadS [ModerationLabel]
-> ReadPrec ModerationLabel
-> ReadPrec [ModerationLabel]
-> Read 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
(Int -> ModerationLabel -> ShowS)
-> (ModerationLabel -> String)
-> ([ModerationLabel] -> ShowS)
-> Show ModerationLabel
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. ModerationLabel -> Rep ModerationLabel x)
-> (forall x. Rep ModerationLabel x -> ModerationLabel)
-> Generic ModerationLabel
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' :: Maybe Double -> Maybe Text -> Maybe Text -> ModerationLabel
ModerationLabel'
    { $sel:confidence:ModerationLabel' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ModerationLabel' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parentName:ModerationLabel' :: Maybe Text
parentName = Maybe Text
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 :: (Maybe Double -> f (Maybe Double))
-> ModerationLabel -> f ModerationLabel
moderationLabel_confidence = (ModerationLabel -> Maybe Double)
-> (ModerationLabel -> Maybe Double -> ModerationLabel)
-> Lens
     ModerationLabel ModerationLabel (Maybe Double) (Maybe Double)
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 :: (Maybe Text -> f (Maybe Text))
-> ModerationLabel -> f ModerationLabel
moderationLabel_name = (ModerationLabel -> Maybe Text)
-> (ModerationLabel -> Maybe Text -> ModerationLabel)
-> Lens ModerationLabel ModerationLabel (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> ModerationLabel -> f ModerationLabel
moderationLabel_parentName = (ModerationLabel -> Maybe Text)
-> (ModerationLabel -> Maybe Text -> ModerationLabel)
-> Lens ModerationLabel ModerationLabel (Maybe Text) (Maybe Text)
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 Core.FromJSON ModerationLabel where
  parseJSON :: Value -> Parser ModerationLabel
parseJSON =
    String
-> (Object -> Parser ModerationLabel)
-> Value
-> Parser ModerationLabel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ModerationLabel"
      ( \Object
x ->
          Maybe Double -> Maybe Text -> Maybe Text -> ModerationLabel
ModerationLabel'
            (Maybe Double -> Maybe Text -> Maybe Text -> ModerationLabel)
-> Parser (Maybe Double)
-> Parser (Maybe Text -> Maybe Text -> ModerationLabel)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Confidence")
            Parser (Maybe Text -> Maybe Text -> ModerationLabel)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ModerationLabel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe Text -> ModerationLabel)
-> Parser (Maybe Text) -> Parser ModerationLabel
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ParentName")
      )

instance Prelude.Hashable ModerationLabel

instance Prelude.NFData ModerationLabel