{-# 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.DetectLabelsImageForeground
-- 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.DetectLabelsImageForeground 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.DetectLabelsImageQuality
import Amazonka.Rekognition.Types.DominantColor

-- | The foreground of the image with regard to image quality and dominant
-- colors.
--
-- /See:/ 'newDetectLabelsImageForeground' smart constructor.
data DetectLabelsImageForeground = DetectLabelsImageForeground'
  { -- | The dominant colors found in the foreground of an image, defined with
    -- RGB values, CSS color name, simplified color name, and PixelPercentage
    -- (the percentage of image pixels that have a particular color).
    DetectLabelsImageForeground -> Maybe [DominantColor]
dominantColors :: Prelude.Maybe [DominantColor],
    -- | The quality of the image foreground as defined by brightness and
    -- sharpness.
    DetectLabelsImageForeground -> Maybe DetectLabelsImageQuality
quality :: Prelude.Maybe DetectLabelsImageQuality
  }
  deriving (DetectLabelsImageForeground -> DetectLabelsImageForeground -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectLabelsImageForeground -> DetectLabelsImageForeground -> Bool
$c/= :: DetectLabelsImageForeground -> DetectLabelsImageForeground -> Bool
== :: DetectLabelsImageForeground -> DetectLabelsImageForeground -> Bool
$c== :: DetectLabelsImageForeground -> DetectLabelsImageForeground -> Bool
Prelude.Eq, ReadPrec [DetectLabelsImageForeground]
ReadPrec DetectLabelsImageForeground
Int -> ReadS DetectLabelsImageForeground
ReadS [DetectLabelsImageForeground]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectLabelsImageForeground]
$creadListPrec :: ReadPrec [DetectLabelsImageForeground]
readPrec :: ReadPrec DetectLabelsImageForeground
$creadPrec :: ReadPrec DetectLabelsImageForeground
readList :: ReadS [DetectLabelsImageForeground]
$creadList :: ReadS [DetectLabelsImageForeground]
readsPrec :: Int -> ReadS DetectLabelsImageForeground
$creadsPrec :: Int -> ReadS DetectLabelsImageForeground
Prelude.Read, Int -> DetectLabelsImageForeground -> ShowS
[DetectLabelsImageForeground] -> ShowS
DetectLabelsImageForeground -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectLabelsImageForeground] -> ShowS
$cshowList :: [DetectLabelsImageForeground] -> ShowS
show :: DetectLabelsImageForeground -> String
$cshow :: DetectLabelsImageForeground -> String
showsPrec :: Int -> DetectLabelsImageForeground -> ShowS
$cshowsPrec :: Int -> DetectLabelsImageForeground -> ShowS
Prelude.Show, forall x.
Rep DetectLabelsImageForeground x -> DetectLabelsImageForeground
forall x.
DetectLabelsImageForeground -> Rep DetectLabelsImageForeground x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DetectLabelsImageForeground x -> DetectLabelsImageForeground
$cfrom :: forall x.
DetectLabelsImageForeground -> Rep DetectLabelsImageForeground x
Prelude.Generic)

-- |
-- Create a value of 'DetectLabelsImageForeground' 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:
--
-- 'dominantColors', 'detectLabelsImageForeground_dominantColors' - The dominant colors found in the foreground of an image, defined with
-- RGB values, CSS color name, simplified color name, and PixelPercentage
-- (the percentage of image pixels that have a particular color).
--
-- 'quality', 'detectLabelsImageForeground_quality' - The quality of the image foreground as defined by brightness and
-- sharpness.
newDetectLabelsImageForeground ::
  DetectLabelsImageForeground
newDetectLabelsImageForeground :: DetectLabelsImageForeground
newDetectLabelsImageForeground =
  DetectLabelsImageForeground'
    { $sel:dominantColors:DetectLabelsImageForeground' :: Maybe [DominantColor]
dominantColors =
        forall a. Maybe a
Prelude.Nothing,
      $sel:quality:DetectLabelsImageForeground' :: Maybe DetectLabelsImageQuality
quality = forall a. Maybe a
Prelude.Nothing
    }

-- | The dominant colors found in the foreground of an image, defined with
-- RGB values, CSS color name, simplified color name, and PixelPercentage
-- (the percentage of image pixels that have a particular color).
detectLabelsImageForeground_dominantColors :: Lens.Lens' DetectLabelsImageForeground (Prelude.Maybe [DominantColor])
detectLabelsImageForeground_dominantColors :: Lens' DetectLabelsImageForeground (Maybe [DominantColor])
detectLabelsImageForeground_dominantColors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsImageForeground' {Maybe [DominantColor]
dominantColors :: Maybe [DominantColor]
$sel:dominantColors:DetectLabelsImageForeground' :: DetectLabelsImageForeground -> Maybe [DominantColor]
dominantColors} -> Maybe [DominantColor]
dominantColors) (\s :: DetectLabelsImageForeground
s@DetectLabelsImageForeground' {} Maybe [DominantColor]
a -> DetectLabelsImageForeground
s {$sel:dominantColors:DetectLabelsImageForeground' :: Maybe [DominantColor]
dominantColors = Maybe [DominantColor]
a} :: DetectLabelsImageForeground) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The quality of the image foreground as defined by brightness and
-- sharpness.
detectLabelsImageForeground_quality :: Lens.Lens' DetectLabelsImageForeground (Prelude.Maybe DetectLabelsImageQuality)
detectLabelsImageForeground_quality :: Lens' DetectLabelsImageForeground (Maybe DetectLabelsImageQuality)
detectLabelsImageForeground_quality = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsImageForeground' {Maybe DetectLabelsImageQuality
quality :: Maybe DetectLabelsImageQuality
$sel:quality:DetectLabelsImageForeground' :: DetectLabelsImageForeground -> Maybe DetectLabelsImageQuality
quality} -> Maybe DetectLabelsImageQuality
quality) (\s :: DetectLabelsImageForeground
s@DetectLabelsImageForeground' {} Maybe DetectLabelsImageQuality
a -> DetectLabelsImageForeground
s {$sel:quality:DetectLabelsImageForeground' :: Maybe DetectLabelsImageQuality
quality = Maybe DetectLabelsImageQuality
a} :: DetectLabelsImageForeground)

instance Data.FromJSON DetectLabelsImageForeground where
  parseJSON :: Value -> Parser DetectLabelsImageForeground
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DetectLabelsImageForeground"
      ( \Object
x ->
          Maybe [DominantColor]
-> Maybe DetectLabelsImageQuality -> DetectLabelsImageForeground
DetectLabelsImageForeground'
            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
"DominantColors" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"Quality")
      )

instance Prelude.Hashable DetectLabelsImageForeground where
  hashWithSalt :: Int -> DetectLabelsImageForeground -> Int
hashWithSalt Int
_salt DetectLabelsImageForeground' {Maybe [DominantColor]
Maybe DetectLabelsImageQuality
quality :: Maybe DetectLabelsImageQuality
dominantColors :: Maybe [DominantColor]
$sel:quality:DetectLabelsImageForeground' :: DetectLabelsImageForeground -> Maybe DetectLabelsImageQuality
$sel:dominantColors:DetectLabelsImageForeground' :: DetectLabelsImageForeground -> Maybe [DominantColor]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DominantColor]
dominantColors
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DetectLabelsImageQuality
quality

instance Prelude.NFData DetectLabelsImageForeground where
  rnf :: DetectLabelsImageForeground -> ()
rnf DetectLabelsImageForeground' {Maybe [DominantColor]
Maybe DetectLabelsImageQuality
quality :: Maybe DetectLabelsImageQuality
dominantColors :: Maybe [DominantColor]
$sel:quality:DetectLabelsImageForeground' :: DetectLabelsImageForeground -> Maybe DetectLabelsImageQuality
$sel:dominantColors:DetectLabelsImageForeground' :: DetectLabelsImageForeground -> Maybe [DominantColor]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DominantColor]
dominantColors
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DetectLabelsImageQuality
quality