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

-- |
-- Create a value of 'MouthOpen' 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', 'mouthOpen_confidence' - Level of confidence in the determination.
--
-- 'value', 'mouthOpen_value' - Boolean value that indicates whether the mouth on the face is open or
-- not.
newMouthOpen ::
  MouthOpen
newMouthOpen :: MouthOpen
newMouthOpen =
  MouthOpen'
    { $sel:confidence:MouthOpen' :: Maybe Double
confidence = forall a. Maybe a
Prelude.Nothing,
      $sel:value:MouthOpen' :: Maybe Bool
value = forall a. Maybe a
Prelude.Nothing
    }

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

-- | Boolean value that indicates whether the mouth on the face is open or
-- not.
mouthOpen_value :: Lens.Lens' MouthOpen (Prelude.Maybe Prelude.Bool)
mouthOpen_value :: Lens' MouthOpen (Maybe Bool)
mouthOpen_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MouthOpen' {Maybe Bool
value :: Maybe Bool
$sel:value:MouthOpen' :: MouthOpen -> Maybe Bool
value} -> Maybe Bool
value) (\s :: MouthOpen
s@MouthOpen' {} Maybe Bool
a -> MouthOpen
s {$sel:value:MouthOpen' :: Maybe Bool
value = Maybe Bool
a} :: MouthOpen)

instance Data.FromJSON MouthOpen where
  parseJSON :: Value -> Parser MouthOpen
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MouthOpen"
      ( \Object
x ->
          Maybe Double -> Maybe Bool -> MouthOpen
MouthOpen'
            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 MouthOpen where
  hashWithSalt :: Int -> MouthOpen -> Int
hashWithSalt Int
_salt MouthOpen' {Maybe Bool
Maybe Double
value :: Maybe Bool
confidence :: Maybe Double
$sel:value:MouthOpen' :: MouthOpen -> Maybe Bool
$sel:confidence:MouthOpen' :: MouthOpen -> 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 MouthOpen where
  rnf :: MouthOpen -> ()
rnf MouthOpen' {Maybe Bool
Maybe Double
value :: Maybe Bool
confidence :: Maybe Double
$sel:value:MouthOpen' :: MouthOpen -> Maybe Bool
$sel:confidence:MouthOpen' :: MouthOpen -> 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