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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types.FaceSearchSettings

-- | Input parameters used to recognize faces in a streaming video analyzed
-- by a Amazon Rekognition stream processor.
--
-- /See:/ 'newStreamProcessorSettings' smart constructor.
data StreamProcessorSettings = StreamProcessorSettings'
  { -- | Face search settings to use on a streaming video.
    StreamProcessorSettings -> Maybe FaceSearchSettings
faceSearch :: Prelude.Maybe FaceSearchSettings
  }
  deriving (StreamProcessorSettings -> StreamProcessorSettings -> Bool
(StreamProcessorSettings -> StreamProcessorSettings -> Bool)
-> (StreamProcessorSettings -> StreamProcessorSettings -> Bool)
-> Eq StreamProcessorSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamProcessorSettings -> StreamProcessorSettings -> Bool
$c/= :: StreamProcessorSettings -> StreamProcessorSettings -> Bool
== :: StreamProcessorSettings -> StreamProcessorSettings -> Bool
$c== :: StreamProcessorSettings -> StreamProcessorSettings -> Bool
Prelude.Eq, ReadPrec [StreamProcessorSettings]
ReadPrec StreamProcessorSettings
Int -> ReadS StreamProcessorSettings
ReadS [StreamProcessorSettings]
(Int -> ReadS StreamProcessorSettings)
-> ReadS [StreamProcessorSettings]
-> ReadPrec StreamProcessorSettings
-> ReadPrec [StreamProcessorSettings]
-> Read StreamProcessorSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamProcessorSettings]
$creadListPrec :: ReadPrec [StreamProcessorSettings]
readPrec :: ReadPrec StreamProcessorSettings
$creadPrec :: ReadPrec StreamProcessorSettings
readList :: ReadS [StreamProcessorSettings]
$creadList :: ReadS [StreamProcessorSettings]
readsPrec :: Int -> ReadS StreamProcessorSettings
$creadsPrec :: Int -> ReadS StreamProcessorSettings
Prelude.Read, Int -> StreamProcessorSettings -> ShowS
[StreamProcessorSettings] -> ShowS
StreamProcessorSettings -> String
(Int -> StreamProcessorSettings -> ShowS)
-> (StreamProcessorSettings -> String)
-> ([StreamProcessorSettings] -> ShowS)
-> Show StreamProcessorSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamProcessorSettings] -> ShowS
$cshowList :: [StreamProcessorSettings] -> ShowS
show :: StreamProcessorSettings -> String
$cshow :: StreamProcessorSettings -> String
showsPrec :: Int -> StreamProcessorSettings -> ShowS
$cshowsPrec :: Int -> StreamProcessorSettings -> ShowS
Prelude.Show, (forall x.
 StreamProcessorSettings -> Rep StreamProcessorSettings x)
-> (forall x.
    Rep StreamProcessorSettings x -> StreamProcessorSettings)
-> Generic StreamProcessorSettings
forall x. Rep StreamProcessorSettings x -> StreamProcessorSettings
forall x. StreamProcessorSettings -> Rep StreamProcessorSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamProcessorSettings x -> StreamProcessorSettings
$cfrom :: forall x. StreamProcessorSettings -> Rep StreamProcessorSettings x
Prelude.Generic)

-- |
-- Create a value of 'StreamProcessorSettings' 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:
--
-- 'faceSearch', 'streamProcessorSettings_faceSearch' - Face search settings to use on a streaming video.
newStreamProcessorSettings ::
  StreamProcessorSettings
newStreamProcessorSettings :: StreamProcessorSettings
newStreamProcessorSettings =
  StreamProcessorSettings' :: Maybe FaceSearchSettings -> StreamProcessorSettings
StreamProcessorSettings'
    { $sel:faceSearch:StreamProcessorSettings' :: Maybe FaceSearchSettings
faceSearch =
        Maybe FaceSearchSettings
forall a. Maybe a
Prelude.Nothing
    }

-- | Face search settings to use on a streaming video.
streamProcessorSettings_faceSearch :: Lens.Lens' StreamProcessorSettings (Prelude.Maybe FaceSearchSettings)
streamProcessorSettings_faceSearch :: (Maybe FaceSearchSettings -> f (Maybe FaceSearchSettings))
-> StreamProcessorSettings -> f StreamProcessorSettings
streamProcessorSettings_faceSearch = (StreamProcessorSettings -> Maybe FaceSearchSettings)
-> (StreamProcessorSettings
    -> Maybe FaceSearchSettings -> StreamProcessorSettings)
-> Lens
     StreamProcessorSettings
     StreamProcessorSettings
     (Maybe FaceSearchSettings)
     (Maybe FaceSearchSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamProcessorSettings' {Maybe FaceSearchSettings
faceSearch :: Maybe FaceSearchSettings
$sel:faceSearch:StreamProcessorSettings' :: StreamProcessorSettings -> Maybe FaceSearchSettings
faceSearch} -> Maybe FaceSearchSettings
faceSearch) (\s :: StreamProcessorSettings
s@StreamProcessorSettings' {} Maybe FaceSearchSettings
a -> StreamProcessorSettings
s {$sel:faceSearch:StreamProcessorSettings' :: Maybe FaceSearchSettings
faceSearch = Maybe FaceSearchSettings
a} :: StreamProcessorSettings)

instance Core.FromJSON StreamProcessorSettings where
  parseJSON :: Value -> Parser StreamProcessorSettings
parseJSON =
    String
-> (Object -> Parser StreamProcessorSettings)
-> Value
-> Parser StreamProcessorSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StreamProcessorSettings"
      ( \Object
x ->
          Maybe FaceSearchSettings -> StreamProcessorSettings
StreamProcessorSettings'
            (Maybe FaceSearchSettings -> StreamProcessorSettings)
-> Parser (Maybe FaceSearchSettings)
-> Parser StreamProcessorSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe FaceSearchSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FaceSearch")
      )

instance Prelude.Hashable StreamProcessorSettings

instance Prelude.NFData StreamProcessorSettings

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