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

-- |
-- Create a value of 'Sunglasses' 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', 'sunglasses_value' - Boolean value that indicates whether the face is wearing sunglasses or
-- not.
--
-- 'confidence', 'sunglasses_confidence' - Level of confidence in the determination.
newSunglasses ::
  Sunglasses
newSunglasses :: Sunglasses
newSunglasses =
  Sunglasses' :: Maybe Bool -> Maybe Double -> Sunglasses
Sunglasses'
    { $sel:value:Sunglasses' :: Maybe Bool
value = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:Sunglasses' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

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

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

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

instance Prelude.NFData Sunglasses