{-# 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.DetectLabelsImageBackground
-- 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.DetectLabelsImageBackground 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 background of the image with regard to image quality and dominant
-- colors.
--
-- /See:/ 'newDetectLabelsImageBackground' smart constructor.
data DetectLabelsImageBackground = DetectLabelsImageBackground'
  { -- | The dominant colors found in the background 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).
    DetectLabelsImageBackground -> Maybe [DominantColor]
dominantColors :: Prelude.Maybe [DominantColor],
    -- | The quality of the image background as defined by brightness and
    -- sharpness.
    DetectLabelsImageBackground -> Maybe DetectLabelsImageQuality
quality :: Prelude.Maybe DetectLabelsImageQuality
  }
  deriving (DetectLabelsImageBackground -> DetectLabelsImageBackground -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectLabelsImageBackground -> DetectLabelsImageBackground -> Bool
$c/= :: DetectLabelsImageBackground -> DetectLabelsImageBackground -> Bool
== :: DetectLabelsImageBackground -> DetectLabelsImageBackground -> Bool
$c== :: DetectLabelsImageBackground -> DetectLabelsImageBackground -> Bool
Prelude.Eq, ReadPrec [DetectLabelsImageBackground]
ReadPrec DetectLabelsImageBackground
Int -> ReadS DetectLabelsImageBackground
ReadS [DetectLabelsImageBackground]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectLabelsImageBackground]
$creadListPrec :: ReadPrec [DetectLabelsImageBackground]
readPrec :: ReadPrec DetectLabelsImageBackground
$creadPrec :: ReadPrec DetectLabelsImageBackground
readList :: ReadS [DetectLabelsImageBackground]
$creadList :: ReadS [DetectLabelsImageBackground]
readsPrec :: Int -> ReadS DetectLabelsImageBackground
$creadsPrec :: Int -> ReadS DetectLabelsImageBackground
Prelude.Read, Int -> DetectLabelsImageBackground -> ShowS
[DetectLabelsImageBackground] -> ShowS
DetectLabelsImageBackground -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectLabelsImageBackground] -> ShowS
$cshowList :: [DetectLabelsImageBackground] -> ShowS
show :: DetectLabelsImageBackground -> String
$cshow :: DetectLabelsImageBackground -> String
showsPrec :: Int -> DetectLabelsImageBackground -> ShowS
$cshowsPrec :: Int -> DetectLabelsImageBackground -> ShowS
Prelude.Show, forall x.
Rep DetectLabelsImageBackground x -> DetectLabelsImageBackground
forall x.
DetectLabelsImageBackground -> Rep DetectLabelsImageBackground x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DetectLabelsImageBackground x -> DetectLabelsImageBackground
$cfrom :: forall x.
DetectLabelsImageBackground -> Rep DetectLabelsImageBackground x
Prelude.Generic)

-- |
-- Create a value of 'DetectLabelsImageBackground' 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', 'detectLabelsImageBackground_dominantColors' - The dominant colors found in the background 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', 'detectLabelsImageBackground_quality' - The quality of the image background as defined by brightness and
-- sharpness.
newDetectLabelsImageBackground ::
  DetectLabelsImageBackground
newDetectLabelsImageBackground :: DetectLabelsImageBackground
newDetectLabelsImageBackground =
  DetectLabelsImageBackground'
    { $sel:dominantColors:DetectLabelsImageBackground' :: Maybe [DominantColor]
dominantColors =
        forall a. Maybe a
Prelude.Nothing,
      $sel:quality:DetectLabelsImageBackground' :: Maybe DetectLabelsImageQuality
quality = forall a. Maybe a
Prelude.Nothing
    }

-- | The dominant colors found in the background 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).
detectLabelsImageBackground_dominantColors :: Lens.Lens' DetectLabelsImageBackground (Prelude.Maybe [DominantColor])
detectLabelsImageBackground_dominantColors :: Lens' DetectLabelsImageBackground (Maybe [DominantColor])
detectLabelsImageBackground_dominantColors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsImageBackground' {Maybe [DominantColor]
dominantColors :: Maybe [DominantColor]
$sel:dominantColors:DetectLabelsImageBackground' :: DetectLabelsImageBackground -> Maybe [DominantColor]
dominantColors} -> Maybe [DominantColor]
dominantColors) (\s :: DetectLabelsImageBackground
s@DetectLabelsImageBackground' {} Maybe [DominantColor]
a -> DetectLabelsImageBackground
s {$sel:dominantColors:DetectLabelsImageBackground' :: Maybe [DominantColor]
dominantColors = Maybe [DominantColor]
a} :: DetectLabelsImageBackground) 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 background as defined by brightness and
-- sharpness.
detectLabelsImageBackground_quality :: Lens.Lens' DetectLabelsImageBackground (Prelude.Maybe DetectLabelsImageQuality)
detectLabelsImageBackground_quality :: Lens' DetectLabelsImageBackground (Maybe DetectLabelsImageQuality)
detectLabelsImageBackground_quality = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectLabelsImageBackground' {Maybe DetectLabelsImageQuality
quality :: Maybe DetectLabelsImageQuality
$sel:quality:DetectLabelsImageBackground' :: DetectLabelsImageBackground -> Maybe DetectLabelsImageQuality
quality} -> Maybe DetectLabelsImageQuality
quality) (\s :: DetectLabelsImageBackground
s@DetectLabelsImageBackground' {} Maybe DetectLabelsImageQuality
a -> DetectLabelsImageBackground
s {$sel:quality:DetectLabelsImageBackground' :: Maybe DetectLabelsImageQuality
quality = Maybe DetectLabelsImageQuality
a} :: DetectLabelsImageBackground)

instance Data.FromJSON DetectLabelsImageBackground where
  parseJSON :: Value -> Parser DetectLabelsImageBackground
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DetectLabelsImageBackground"
      ( \Object
x ->
          Maybe [DominantColor]
-> Maybe DetectLabelsImageQuality -> DetectLabelsImageBackground
DetectLabelsImageBackground'
            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 DetectLabelsImageBackground where
  hashWithSalt :: Int -> DetectLabelsImageBackground -> Int
hashWithSalt Int
_salt DetectLabelsImageBackground' {Maybe [DominantColor]
Maybe DetectLabelsImageQuality
quality :: Maybe DetectLabelsImageQuality
dominantColors :: Maybe [DominantColor]
$sel:quality:DetectLabelsImageBackground' :: DetectLabelsImageBackground -> Maybe DetectLabelsImageQuality
$sel:dominantColors:DetectLabelsImageBackground' :: DetectLabelsImageBackground -> 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 DetectLabelsImageBackground where
  rnf :: DetectLabelsImageBackground -> ()
rnf DetectLabelsImageBackground' {Maybe [DominantColor]
Maybe DetectLabelsImageQuality
quality :: Maybe DetectLabelsImageQuality
dominantColors :: Maybe [DominantColor]
$sel:quality:DetectLabelsImageBackground' :: DetectLabelsImageBackground -> Maybe DetectLabelsImageQuality
$sel:dominantColors:DetectLabelsImageBackground' :: DetectLabelsImageBackground -> 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