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

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

-- | Level of confidence in the determination.
eyeOpen_confidence :: Lens.Lens' EyeOpen (Prelude.Maybe Prelude.Double)
eyeOpen_confidence :: Lens' EyeOpen (Maybe Double)
eyeOpen_confidence = 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)

-- | Boolean value that indicates whether the eyes on the face are open.
eyeOpen_value :: Lens.Lens' EyeOpen (Prelude.Maybe Prelude.Bool)
eyeOpen_value :: Lens' EyeOpen (Maybe Bool)
eyeOpen_value = 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)

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

instance Prelude.Hashable EyeOpen where
  hashWithSalt :: Int -> EyeOpen -> Int
hashWithSalt Int
_salt EyeOpen' {Maybe Bool
Maybe Double
value :: Maybe Bool
confidence :: Maybe Double
$sel:value:EyeOpen' :: EyeOpen -> Maybe Bool
$sel:confidence:EyeOpen' :: EyeOpen -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
confidence
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
value

instance Prelude.NFData EyeOpen where
  rnf :: EyeOpen -> ()
rnf EyeOpen' {Maybe Bool
Maybe Double
value :: Maybe Bool
confidence :: Maybe Double
$sel:value:EyeOpen' :: EyeOpen -> Maybe Bool
$sel:confidence:EyeOpen' :: EyeOpen -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
confidence
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
value