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

-- | Identifies face image brightness and sharpness.
--
-- /See:/ 'newImageQuality' smart constructor.
data ImageQuality = ImageQuality'
  { -- | Value representing brightness of the face. The service returns a value
    -- between 0 and 100 (inclusive). A higher value indicates a brighter face
    -- image.
    ImageQuality -> Maybe Double
brightness :: Prelude.Maybe Prelude.Double,
    -- | Value representing sharpness of the face. The service returns a value
    -- between 0 and 100 (inclusive). A higher value indicates a sharper face
    -- image.
    ImageQuality -> Maybe Double
sharpness :: Prelude.Maybe Prelude.Double
  }
  deriving (ImageQuality -> ImageQuality -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageQuality -> ImageQuality -> Bool
$c/= :: ImageQuality -> ImageQuality -> Bool
== :: ImageQuality -> ImageQuality -> Bool
$c== :: ImageQuality -> ImageQuality -> Bool
Prelude.Eq, ReadPrec [ImageQuality]
ReadPrec ImageQuality
Int -> ReadS ImageQuality
ReadS [ImageQuality]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImageQuality]
$creadListPrec :: ReadPrec [ImageQuality]
readPrec :: ReadPrec ImageQuality
$creadPrec :: ReadPrec ImageQuality
readList :: ReadS [ImageQuality]
$creadList :: ReadS [ImageQuality]
readsPrec :: Int -> ReadS ImageQuality
$creadsPrec :: Int -> ReadS ImageQuality
Prelude.Read, Int -> ImageQuality -> ShowS
[ImageQuality] -> ShowS
ImageQuality -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageQuality] -> ShowS
$cshowList :: [ImageQuality] -> ShowS
show :: ImageQuality -> String
$cshow :: ImageQuality -> String
showsPrec :: Int -> ImageQuality -> ShowS
$cshowsPrec :: Int -> ImageQuality -> ShowS
Prelude.Show, forall x. Rep ImageQuality x -> ImageQuality
forall x. ImageQuality -> Rep ImageQuality x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageQuality x -> ImageQuality
$cfrom :: forall x. ImageQuality -> Rep ImageQuality x
Prelude.Generic)

-- |
-- Create a value of 'ImageQuality' 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:
--
-- 'brightness', 'imageQuality_brightness' - Value representing brightness of the face. The service returns a value
-- between 0 and 100 (inclusive). A higher value indicates a brighter face
-- image.
--
-- 'sharpness', 'imageQuality_sharpness' - Value representing sharpness of the face. The service returns a value
-- between 0 and 100 (inclusive). A higher value indicates a sharper face
-- image.
newImageQuality ::
  ImageQuality
newImageQuality :: ImageQuality
newImageQuality =
  ImageQuality'
    { $sel:brightness:ImageQuality' :: Maybe Double
brightness = forall a. Maybe a
Prelude.Nothing,
      $sel:sharpness:ImageQuality' :: Maybe Double
sharpness = forall a. Maybe a
Prelude.Nothing
    }

-- | Value representing brightness of the face. The service returns a value
-- between 0 and 100 (inclusive). A higher value indicates a brighter face
-- image.
imageQuality_brightness :: Lens.Lens' ImageQuality (Prelude.Maybe Prelude.Double)
imageQuality_brightness :: Lens' ImageQuality (Maybe Double)
imageQuality_brightness = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageQuality' {Maybe Double
brightness :: Maybe Double
$sel:brightness:ImageQuality' :: ImageQuality -> Maybe Double
brightness} -> Maybe Double
brightness) (\s :: ImageQuality
s@ImageQuality' {} Maybe Double
a -> ImageQuality
s {$sel:brightness:ImageQuality' :: Maybe Double
brightness = Maybe Double
a} :: ImageQuality)

-- | Value representing sharpness of the face. The service returns a value
-- between 0 and 100 (inclusive). A higher value indicates a sharper face
-- image.
imageQuality_sharpness :: Lens.Lens' ImageQuality (Prelude.Maybe Prelude.Double)
imageQuality_sharpness :: Lens' ImageQuality (Maybe Double)
imageQuality_sharpness = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageQuality' {Maybe Double
sharpness :: Maybe Double
$sel:sharpness:ImageQuality' :: ImageQuality -> Maybe Double
sharpness} -> Maybe Double
sharpness) (\s :: ImageQuality
s@ImageQuality' {} Maybe Double
a -> ImageQuality
s {$sel:sharpness:ImageQuality' :: Maybe Double
sharpness = Maybe Double
a} :: ImageQuality)

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

instance Prelude.Hashable ImageQuality where
  hashWithSalt :: Int -> ImageQuality -> Int
hashWithSalt Int
_salt ImageQuality' {Maybe Double
sharpness :: Maybe Double
brightness :: Maybe Double
$sel:sharpness:ImageQuality' :: ImageQuality -> Maybe Double
$sel:brightness:ImageQuality' :: ImageQuality -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
brightness
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
sharpness

instance Prelude.NFData ImageQuality where
  rnf :: ImageQuality -> ()
rnf ImageQuality' {Maybe Double
sharpness :: Maybe Double
brightness :: Maybe Double
$sel:sharpness:ImageQuality' :: ImageQuality -> Maybe Double
$sel:brightness:ImageQuality' :: ImageQuality -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
brightness
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
sharpness