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

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

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

-- |
-- Create a value of 'EyeOpen' 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', 'eyeOpen_value' - Boolean value that indicates whether the eyes on the face are open.
--
-- 'confidence', 'eyeOpen_confidence' - Level of confidence in the determination.
newEyeOpen ::
  EyeOpen
newEyeOpen :: EyeOpen
newEyeOpen =
  EyeOpen' :: Maybe Bool -> Maybe Double -> EyeOpen
EyeOpen'
    { $sel:value:EyeOpen' :: Maybe Bool
value = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:EyeOpen' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | Boolean value that indicates whether the eyes on the face are open.
eyeOpen_value :: Lens.Lens' EyeOpen (Prelude.Maybe Prelude.Bool)
eyeOpen_value :: (Maybe Bool -> f (Maybe Bool)) -> EyeOpen -> f EyeOpen
eyeOpen_value = (EyeOpen -> Maybe Bool)
-> (EyeOpen -> Maybe Bool -> EyeOpen)
-> Lens EyeOpen EyeOpen (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EyeOpen' {Maybe Bool
value :: Maybe Bool
$sel:value:EyeOpen' :: EyeOpen -> Maybe Bool
value} -> Maybe Bool
value) (\s :: EyeOpen
s@EyeOpen' {} Maybe Bool
a -> EyeOpen
s {$sel:value:EyeOpen' :: Maybe Bool
value = Maybe Bool
a} :: EyeOpen)

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

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

instance Prelude.NFData EyeOpen