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

-- |
-- Create a value of 'Beard' 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', 'beard_value' - Boolean value that indicates whether the face has beard or not.
--
-- 'confidence', 'beard_confidence' - Level of confidence in the determination.
newBeard ::
  Beard
newBeard :: Beard
newBeard =
  Beard' :: Maybe Bool -> Maybe Double -> Beard
Beard'
    { $sel:value:Beard' :: Maybe Bool
value = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:confidence:Beard' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | Boolean value that indicates whether the face has beard or not.
beard_value :: Lens.Lens' Beard (Prelude.Maybe Prelude.Bool)
beard_value :: (Maybe Bool -> f (Maybe Bool)) -> Beard -> f Beard
beard_value = (Beard -> Maybe Bool)
-> (Beard -> Maybe Bool -> Beard)
-> Lens Beard Beard (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Beard' {Maybe Bool
value :: Maybe Bool
$sel:value:Beard' :: Beard -> Maybe Bool
value} -> Maybe Bool
value) (\s :: Beard
s@Beard' {} Maybe Bool
a -> Beard
s {$sel:value:Beard' :: Maybe Bool
value = Maybe Bool
a} :: Beard)

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

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

instance Prelude.NFData Beard