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

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

-- | Input face recognition parameters for an Amazon Rekognition stream
-- processor. @FaceRecognitionSettings@ is a request parameter for
-- CreateStreamProcessor.
--
-- /See:/ 'newFaceSearchSettings' smart constructor.
data FaceSearchSettings = FaceSearchSettings'
  { -- | Minimum face match confidence score that must be met to return a result
    -- for a recognized face. Default is 80. 0 is the lowest confidence. 100 is
    -- the highest confidence.
    FaceSearchSettings -> Maybe Double
faceMatchThreshold :: Prelude.Maybe Prelude.Double,
    -- | The ID of a collection that contains faces that you want to search for.
    FaceSearchSettings -> Maybe Text
collectionId :: Prelude.Maybe Prelude.Text
  }
  deriving (FaceSearchSettings -> FaceSearchSettings -> Bool
(FaceSearchSettings -> FaceSearchSettings -> Bool)
-> (FaceSearchSettings -> FaceSearchSettings -> Bool)
-> Eq FaceSearchSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FaceSearchSettings -> FaceSearchSettings -> Bool
$c/= :: FaceSearchSettings -> FaceSearchSettings -> Bool
== :: FaceSearchSettings -> FaceSearchSettings -> Bool
$c== :: FaceSearchSettings -> FaceSearchSettings -> Bool
Prelude.Eq, ReadPrec [FaceSearchSettings]
ReadPrec FaceSearchSettings
Int -> ReadS FaceSearchSettings
ReadS [FaceSearchSettings]
(Int -> ReadS FaceSearchSettings)
-> ReadS [FaceSearchSettings]
-> ReadPrec FaceSearchSettings
-> ReadPrec [FaceSearchSettings]
-> Read FaceSearchSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FaceSearchSettings]
$creadListPrec :: ReadPrec [FaceSearchSettings]
readPrec :: ReadPrec FaceSearchSettings
$creadPrec :: ReadPrec FaceSearchSettings
readList :: ReadS [FaceSearchSettings]
$creadList :: ReadS [FaceSearchSettings]
readsPrec :: Int -> ReadS FaceSearchSettings
$creadsPrec :: Int -> ReadS FaceSearchSettings
Prelude.Read, Int -> FaceSearchSettings -> ShowS
[FaceSearchSettings] -> ShowS
FaceSearchSettings -> String
(Int -> FaceSearchSettings -> ShowS)
-> (FaceSearchSettings -> String)
-> ([FaceSearchSettings] -> ShowS)
-> Show FaceSearchSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FaceSearchSettings] -> ShowS
$cshowList :: [FaceSearchSettings] -> ShowS
show :: FaceSearchSettings -> String
$cshow :: FaceSearchSettings -> String
showsPrec :: Int -> FaceSearchSettings -> ShowS
$cshowsPrec :: Int -> FaceSearchSettings -> ShowS
Prelude.Show, (forall x. FaceSearchSettings -> Rep FaceSearchSettings x)
-> (forall x. Rep FaceSearchSettings x -> FaceSearchSettings)
-> Generic FaceSearchSettings
forall x. Rep FaceSearchSettings x -> FaceSearchSettings
forall x. FaceSearchSettings -> Rep FaceSearchSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FaceSearchSettings x -> FaceSearchSettings
$cfrom :: forall x. FaceSearchSettings -> Rep FaceSearchSettings x
Prelude.Generic)

-- |
-- Create a value of 'FaceSearchSettings' 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:
--
-- 'faceMatchThreshold', 'faceSearchSettings_faceMatchThreshold' - Minimum face match confidence score that must be met to return a result
-- for a recognized face. Default is 80. 0 is the lowest confidence. 100 is
-- the highest confidence.
--
-- 'collectionId', 'faceSearchSettings_collectionId' - The ID of a collection that contains faces that you want to search for.
newFaceSearchSettings ::
  FaceSearchSettings
newFaceSearchSettings :: FaceSearchSettings
newFaceSearchSettings =
  FaceSearchSettings' :: Maybe Double -> Maybe Text -> FaceSearchSettings
FaceSearchSettings'
    { $sel:faceMatchThreshold:FaceSearchSettings' :: Maybe Double
faceMatchThreshold =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:collectionId:FaceSearchSettings' :: Maybe Text
collectionId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Minimum face match confidence score that must be met to return a result
-- for a recognized face. Default is 80. 0 is the lowest confidence. 100 is
-- the highest confidence.
faceSearchSettings_faceMatchThreshold :: Lens.Lens' FaceSearchSettings (Prelude.Maybe Prelude.Double)
faceSearchSettings_faceMatchThreshold :: (Maybe Double -> f (Maybe Double))
-> FaceSearchSettings -> f FaceSearchSettings
faceSearchSettings_faceMatchThreshold = (FaceSearchSettings -> Maybe Double)
-> (FaceSearchSettings -> Maybe Double -> FaceSearchSettings)
-> Lens
     FaceSearchSettings FaceSearchSettings (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FaceSearchSettings' {Maybe Double
faceMatchThreshold :: Maybe Double
$sel:faceMatchThreshold:FaceSearchSettings' :: FaceSearchSettings -> Maybe Double
faceMatchThreshold} -> Maybe Double
faceMatchThreshold) (\s :: FaceSearchSettings
s@FaceSearchSettings' {} Maybe Double
a -> FaceSearchSettings
s {$sel:faceMatchThreshold:FaceSearchSettings' :: Maybe Double
faceMatchThreshold = Maybe Double
a} :: FaceSearchSettings)

-- | The ID of a collection that contains faces that you want to search for.
faceSearchSettings_collectionId :: Lens.Lens' FaceSearchSettings (Prelude.Maybe Prelude.Text)
faceSearchSettings_collectionId :: (Maybe Text -> f (Maybe Text))
-> FaceSearchSettings -> f FaceSearchSettings
faceSearchSettings_collectionId = (FaceSearchSettings -> Maybe Text)
-> (FaceSearchSettings -> Maybe Text -> FaceSearchSettings)
-> Lens
     FaceSearchSettings FaceSearchSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FaceSearchSettings' {Maybe Text
collectionId :: Maybe Text
$sel:collectionId:FaceSearchSettings' :: FaceSearchSettings -> Maybe Text
collectionId} -> Maybe Text
collectionId) (\s :: FaceSearchSettings
s@FaceSearchSettings' {} Maybe Text
a -> FaceSearchSettings
s {$sel:collectionId:FaceSearchSettings' :: Maybe Text
collectionId = Maybe Text
a} :: FaceSearchSettings)

instance Core.FromJSON FaceSearchSettings where
  parseJSON :: Value -> Parser FaceSearchSettings
parseJSON =
    String
-> (Object -> Parser FaceSearchSettings)
-> Value
-> Parser FaceSearchSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FaceSearchSettings"
      ( \Object
x ->
          Maybe Double -> Maybe Text -> FaceSearchSettings
FaceSearchSettings'
            (Maybe Double -> Maybe Text -> FaceSearchSettings)
-> Parser (Maybe Double)
-> Parser (Maybe Text -> FaceSearchSettings)
forall (f :: * -> *) a b. Functor 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
"FaceMatchThreshold")
            Parser (Maybe Text -> FaceSearchSettings)
-> Parser (Maybe Text) -> Parser FaceSearchSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CollectionId")
      )

instance Prelude.Hashable FaceSearchSettings

instance Prelude.NFData FaceSearchSettings

instance Core.ToJSON FaceSearchSettings where
  toJSON :: FaceSearchSettings -> Value
toJSON FaceSearchSettings' {Maybe Double
Maybe Text
collectionId :: Maybe Text
faceMatchThreshold :: Maybe Double
$sel:collectionId:FaceSearchSettings' :: FaceSearchSettings -> Maybe Text
$sel:faceMatchThreshold:FaceSearchSettings' :: FaceSearchSettings -> Maybe Double
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"FaceMatchThreshold" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
faceMatchThreshold,
            (Text
"CollectionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
collectionId
          ]
      )