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

-- | Information about the quality and dominant colors of an input image.
-- Quality and color information is returned for the entire image,
-- foreground, and background.
--
-- /See:/ 'newDetectLabelsImageProperties' smart constructor.
data DetectLabelsImageProperties = DetectLabelsImageProperties'
  { -- | Information about the properties of an image’s background, including the
    -- background’s quality and dominant colors, including the quality and
    -- dominant colors of the image.
    DetectLabelsImageProperties -> Maybe DetectLabelsImageBackground
background :: Prelude.Maybe DetectLabelsImageBackground,
    -- | Information about the dominant colors found in an image, described with
    -- RGB values, CSS color name, simplified color name, and PixelPercentage
    -- (the percentage of image pixels that have a particular color).
    DetectLabelsImageProperties -> Maybe [DominantColor]
dominantColors :: Prelude.Maybe [DominantColor],
    -- | Information about the properties of an image’s foreground, including the
    -- foreground’s quality and dominant colors, including the quality and
    -- dominant colors of the image.
    DetectLabelsImageProperties -> Maybe DetectLabelsImageForeground
foreground :: Prelude.Maybe DetectLabelsImageForeground,
    -- | Information about the quality of the image foreground as defined by
    -- brightness, sharpness, and contrast. The higher the value the greater
    -- the brightness, sharpness, and contrast respectively.
    DetectLabelsImageProperties -> Maybe DetectLabelsImageQuality
quality :: Prelude.Maybe DetectLabelsImageQuality
  }
  deriving (DetectLabelsImageProperties -> DetectLabelsImageProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectLabelsImageProperties -> DetectLabelsImageProperties -> Bool
$c/= :: DetectLabelsImageProperties -> DetectLabelsImageProperties -> Bool
== :: DetectLabelsImageProperties -> DetectLabelsImageProperties -> Bool
$c== :: DetectLabelsImageProperties -> DetectLabelsImageProperties -> Bool
Prelude.Eq, ReadPrec [DetectLabelsImageProperties]
ReadPrec DetectLabelsImageProperties
Int -> ReadS DetectLabelsImageProperties
ReadS [DetectLabelsImageProperties]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectLabelsImageProperties]
$creadListPrec :: ReadPrec [DetectLabelsImageProperties]
readPrec :: ReadPrec DetectLabelsImageProperties
$creadPrec :: ReadPrec DetectLabelsImageProperties
readList :: ReadS [DetectLabelsImageProperties]
$creadList :: ReadS [DetectLabelsImageProperties]
readsPrec :: Int -> ReadS DetectLabelsImageProperties
$creadsPrec :: Int -> ReadS DetectLabelsImageProperties
Prelude.Read, Int -> DetectLabelsImageProperties -> ShowS
[DetectLabelsImageProperties] -> ShowS
DetectLabelsImageProperties -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectLabelsImageProperties] -> ShowS
$cshowList :: [DetectLabelsImageProperties] -> ShowS
show :: DetectLabelsImageProperties -> String
$cshow :: DetectLabelsImageProperties -> String
showsPrec :: Int -> DetectLabelsImageProperties -> ShowS
$cshowsPrec :: Int -> DetectLabelsImageProperties -> ShowS
Prelude.Show, forall x.
Rep DetectLabelsImageProperties x -> DetectLabelsImageProperties
forall x.
DetectLabelsImageProperties -> Rep DetectLabelsImageProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DetectLabelsImageProperties x -> DetectLabelsImageProperties
$cfrom :: forall x.
DetectLabelsImageProperties -> Rep DetectLabelsImageProperties x
Prelude.Generic)

-- |
-- Create a value of 'DetectLabelsImageProperties' 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:
--
-- 'background', 'detectLabelsImageProperties_background' - Information about the properties of an image’s background, including the
-- background’s quality and dominant colors, including the quality and
-- dominant colors of the image.
--
-- 'dominantColors', 'detectLabelsImageProperties_dominantColors' - Information about the dominant colors found in an image, described with
-- RGB values, CSS color name, simplified color name, and PixelPercentage
-- (the percentage of image pixels that have a particular color).
--
-- 'foreground', 'detectLabelsImageProperties_foreground' - Information about the properties of an image’s foreground, including the
-- foreground’s quality and dominant colors, including the quality and
-- dominant colors of the image.
--
-- 'quality', 'detectLabelsImageProperties_quality' - Information about the quality of the image foreground as defined by
-- brightness, sharpness, and contrast. The higher the value the greater
-- the brightness, sharpness, and contrast respectively.
newDetectLabelsImageProperties ::
  DetectLabelsImageProperties
newDetectLabelsImageProperties :: DetectLabelsImageProperties
newDetectLabelsImageProperties =
  DetectLabelsImageProperties'
    { $sel:background:DetectLabelsImageProperties' :: Maybe DetectLabelsImageBackground
background =
        forall a. Maybe a
Prelude.Nothing,
      $sel:dominantColors:DetectLabelsImageProperties' :: Maybe [DominantColor]
dominantColors = forall a. Maybe a
Prelude.Nothing,
      $sel:foreground:DetectLabelsImageProperties' :: Maybe DetectLabelsImageForeground
foreground = forall a. Maybe a
Prelude.Nothing,
      $sel:quality:DetectLabelsImageProperties' :: Maybe DetectLabelsImageQuality
quality = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the properties of an image’s background, including the
-- background’s quality and dominant colors, including the quality and
-- dominant colors of the image.
detectLabelsImageProperties_background :: Lens.Lens' DetectLabelsImageProperties (Prelude.Maybe DetectLabelsImageBackground)
detectLabelsImageProperties_background :: Lens'
  DetectLabelsImageProperties (Maybe DetectLabelsImageBackground)
detectLabelsImageProperties_background = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsImageProperties' {Maybe DetectLabelsImageBackground
background :: Maybe DetectLabelsImageBackground
$sel:background:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe DetectLabelsImageBackground
background} -> Maybe DetectLabelsImageBackground
background) (\s :: DetectLabelsImageProperties
s@DetectLabelsImageProperties' {} Maybe DetectLabelsImageBackground
a -> DetectLabelsImageProperties
s {$sel:background:DetectLabelsImageProperties' :: Maybe DetectLabelsImageBackground
background = Maybe DetectLabelsImageBackground
a} :: DetectLabelsImageProperties)

-- | Information about the dominant colors found in an image, described with
-- RGB values, CSS color name, simplified color name, and PixelPercentage
-- (the percentage of image pixels that have a particular color).
detectLabelsImageProperties_dominantColors :: Lens.Lens' DetectLabelsImageProperties (Prelude.Maybe [DominantColor])
detectLabelsImageProperties_dominantColors :: Lens' DetectLabelsImageProperties (Maybe [DominantColor])
detectLabelsImageProperties_dominantColors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsImageProperties' {Maybe [DominantColor]
dominantColors :: Maybe [DominantColor]
$sel:dominantColors:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe [DominantColor]
dominantColors} -> Maybe [DominantColor]
dominantColors) (\s :: DetectLabelsImageProperties
s@DetectLabelsImageProperties' {} Maybe [DominantColor]
a -> DetectLabelsImageProperties
s {$sel:dominantColors:DetectLabelsImageProperties' :: Maybe [DominantColor]
dominantColors = Maybe [DominantColor]
a} :: DetectLabelsImageProperties) 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

-- | Information about the properties of an image’s foreground, including the
-- foreground’s quality and dominant colors, including the quality and
-- dominant colors of the image.
detectLabelsImageProperties_foreground :: Lens.Lens' DetectLabelsImageProperties (Prelude.Maybe DetectLabelsImageForeground)
detectLabelsImageProperties_foreground :: Lens'
  DetectLabelsImageProperties (Maybe DetectLabelsImageForeground)
detectLabelsImageProperties_foreground = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsImageProperties' {Maybe DetectLabelsImageForeground
foreground :: Maybe DetectLabelsImageForeground
$sel:foreground:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe DetectLabelsImageForeground
foreground} -> Maybe DetectLabelsImageForeground
foreground) (\s :: DetectLabelsImageProperties
s@DetectLabelsImageProperties' {} Maybe DetectLabelsImageForeground
a -> DetectLabelsImageProperties
s {$sel:foreground:DetectLabelsImageProperties' :: Maybe DetectLabelsImageForeground
foreground = Maybe DetectLabelsImageForeground
a} :: DetectLabelsImageProperties)

-- | Information about the quality of the image foreground as defined by
-- brightness, sharpness, and contrast. The higher the value the greater
-- the brightness, sharpness, and contrast respectively.
detectLabelsImageProperties_quality :: Lens.Lens' DetectLabelsImageProperties (Prelude.Maybe DetectLabelsImageQuality)
detectLabelsImageProperties_quality :: Lens' DetectLabelsImageProperties (Maybe DetectLabelsImageQuality)
detectLabelsImageProperties_quality = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsImageProperties' {Maybe DetectLabelsImageQuality
quality :: Maybe DetectLabelsImageQuality
$sel:quality:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe DetectLabelsImageQuality
quality} -> Maybe DetectLabelsImageQuality
quality) (\s :: DetectLabelsImageProperties
s@DetectLabelsImageProperties' {} Maybe DetectLabelsImageQuality
a -> DetectLabelsImageProperties
s {$sel:quality:DetectLabelsImageProperties' :: Maybe DetectLabelsImageQuality
quality = Maybe DetectLabelsImageQuality
a} :: DetectLabelsImageProperties)

instance Data.FromJSON DetectLabelsImageProperties where
  parseJSON :: Value -> Parser DetectLabelsImageProperties
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DetectLabelsImageProperties"
      ( \Object
x ->
          Maybe DetectLabelsImageBackground
-> Maybe [DominantColor]
-> Maybe DetectLabelsImageForeground
-> Maybe DetectLabelsImageQuality
-> DetectLabelsImageProperties
DetectLabelsImageProperties'
            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
"Background")
            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
"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
"Foreground")
            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 DetectLabelsImageProperties where
  hashWithSalt :: Int -> DetectLabelsImageProperties -> Int
hashWithSalt Int
_salt DetectLabelsImageProperties' {Maybe [DominantColor]
Maybe DetectLabelsImageQuality
Maybe DetectLabelsImageForeground
Maybe DetectLabelsImageBackground
quality :: Maybe DetectLabelsImageQuality
foreground :: Maybe DetectLabelsImageForeground
dominantColors :: Maybe [DominantColor]
background :: Maybe DetectLabelsImageBackground
$sel:quality:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe DetectLabelsImageQuality
$sel:foreground:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe DetectLabelsImageForeground
$sel:dominantColors:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe [DominantColor]
$sel:background:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe DetectLabelsImageBackground
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DetectLabelsImageBackground
background
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DominantColor]
dominantColors
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DetectLabelsImageForeground
foreground
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DetectLabelsImageQuality
quality

instance Prelude.NFData DetectLabelsImageProperties where
  rnf :: DetectLabelsImageProperties -> ()
rnf DetectLabelsImageProperties' {Maybe [DominantColor]
Maybe DetectLabelsImageQuality
Maybe DetectLabelsImageForeground
Maybe DetectLabelsImageBackground
quality :: Maybe DetectLabelsImageQuality
foreground :: Maybe DetectLabelsImageForeground
dominantColors :: Maybe [DominantColor]
background :: Maybe DetectLabelsImageBackground
$sel:quality:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe DetectLabelsImageQuality
$sel:foreground:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe DetectLabelsImageForeground
$sel:dominantColors:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe [DominantColor]
$sel:background:DetectLabelsImageProperties' :: DetectLabelsImageProperties -> Maybe DetectLabelsImageBackground
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DetectLabelsImageBackground
background
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 DetectLabelsImageForeground
foreground
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DetectLabelsImageQuality
quality