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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Indicates whether or not the face is wearing eye glasses, and the
-- confidence level in the determination.
--
-- /See:/ 'newEyeglasses' smart constructor.
data Eyeglasses = Eyeglasses'
  { -- | Boolean value that indicates whether the face is wearing eye glasses or
    -- not.
    Eyeglasses -> Maybe Bool
value :: Prelude.Maybe Prelude.Bool,
    -- | Level of confidence in the determination.
    Eyeglasses -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double
  }
  deriving (Eyeglasses -> Eyeglasses -> Bool
(Eyeglasses -> Eyeglasses -> Bool)
-> (Eyeglasses -> Eyeglasses -> Bool) -> Eq Eyeglasses
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Eyeglasses -> Eyeglasses -> Bool
$c/= :: Eyeglasses -> Eyeglasses -> Bool
== :: Eyeglasses -> Eyeglasses -> Bool
$c== :: Eyeglasses -> Eyeglasses -> Bool
Prelude.Eq, ReadPrec [Eyeglasses]
ReadPrec Eyeglasses
Int -> ReadS Eyeglasses
ReadS [Eyeglasses]
(Int -> ReadS Eyeglasses)
-> ReadS [Eyeglasses]
-> ReadPrec Eyeglasses
-> ReadPrec [Eyeglasses]
-> Read Eyeglasses
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Eyeglasses]
$creadListPrec :: ReadPrec [Eyeglasses]
readPrec :: ReadPrec Eyeglasses
$creadPrec :: ReadPrec Eyeglasses
readList :: ReadS [Eyeglasses]
$creadList :: ReadS [Eyeglasses]
readsPrec :: Int -> ReadS Eyeglasses
$creadsPrec :: Int -> ReadS Eyeglasses
Prelude.Read, Int -> Eyeglasses -> ShowS
[Eyeglasses] -> ShowS
Eyeglasses -> String
(Int -> Eyeglasses -> ShowS)
-> (Eyeglasses -> String)
-> ([Eyeglasses] -> ShowS)
-> Show Eyeglasses
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Eyeglasses] -> ShowS
$cshowList :: [Eyeglasses] -> ShowS
show :: Eyeglasses -> String
$cshow :: Eyeglasses -> String
showsPrec :: Int -> Eyeglasses -> ShowS
$cshowsPrec :: Int -> Eyeglasses -> ShowS
Prelude.Show, (forall x. Eyeglasses -> Rep Eyeglasses x)
-> (forall x. Rep Eyeglasses x -> Eyeglasses) -> Generic Eyeglasses
forall x. Rep Eyeglasses x -> Eyeglasses
forall x. Eyeglasses -> Rep Eyeglasses x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Eyeglasses x -> Eyeglasses
$cfrom :: forall x. Eyeglasses -> Rep Eyeglasses x
Prelude.Generic)

-- |
-- Create a value of 'Eyeglasses' 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:
--
-- 'value', 'eyeglasses_value' - Boolean value that indicates whether the face is wearing eye glasses or
-- not.
--
-- 'confidence', 'eyeglasses_confidence' - Level of confidence in the determination.
newEyeglasses ::
  Eyeglasses
newEyeglasses :: Eyeglasses
newEyeglasses =
  Eyeglasses' :: Maybe Bool -> Maybe Double -> Eyeglasses
Eyeglasses'
    { $sel:value:Eyeglasses' :: Maybe Bool
value = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:Eyeglasses' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | Boolean value that indicates whether the face is wearing eye glasses or
-- not.
eyeglasses_value :: Lens.Lens' Eyeglasses (Prelude.Maybe Prelude.Bool)
eyeglasses_value :: (Maybe Bool -> f (Maybe Bool)) -> Eyeglasses -> f Eyeglasses
eyeglasses_value = (Eyeglasses -> Maybe Bool)
-> (Eyeglasses -> Maybe Bool -> Eyeglasses)
-> Lens Eyeglasses Eyeglasses (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Eyeglasses' {Maybe Bool
value :: Maybe Bool
$sel:value:Eyeglasses' :: Eyeglasses -> Maybe Bool
value} -> Maybe Bool
value) (\s :: Eyeglasses
s@Eyeglasses' {} Maybe Bool
a -> Eyeglasses
s {$sel:value:Eyeglasses' :: Maybe Bool
value = Maybe Bool
a} :: Eyeglasses)

-- | Level of confidence in the determination.
eyeglasses_confidence :: Lens.Lens' Eyeglasses (Prelude.Maybe Prelude.Double)
eyeglasses_confidence :: (Maybe Double -> f (Maybe Double)) -> Eyeglasses -> f Eyeglasses
eyeglasses_confidence = (Eyeglasses -> Maybe Double)
-> (Eyeglasses -> Maybe Double -> Eyeglasses)
-> Lens Eyeglasses Eyeglasses (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Eyeglasses' {Maybe Double
confidence :: Maybe Double
$sel:confidence:Eyeglasses' :: Eyeglasses -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: Eyeglasses
s@Eyeglasses' {} Maybe Double
a -> Eyeglasses
s {$sel:confidence:Eyeglasses' :: Maybe Double
confidence = Maybe Double
a} :: Eyeglasses)

instance Core.FromJSON Eyeglasses where
  parseJSON :: Value -> Parser Eyeglasses
parseJSON =
    String
-> (Object -> Parser Eyeglasses) -> Value -> Parser Eyeglasses
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Eyeglasses"
      ( \Object
x ->
          Maybe Bool -> Maybe Double -> Eyeglasses
Eyeglasses'
            (Maybe Bool -> Maybe Double -> Eyeglasses)
-> Parser (Maybe Bool) -> Parser (Maybe Double -> Eyeglasses)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value")
            Parser (Maybe Double -> Eyeglasses)
-> Parser (Maybe Double) -> Parser Eyeglasses
forall (f :: * -> *) a b. Applicative f => 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")
      )

instance Prelude.Hashable Eyeglasses

instance Prelude.NFData Eyeglasses