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

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

-- | Information about the source streaming video.
--
-- /See:/ 'newStreamProcessorInput' smart constructor.
data StreamProcessorInput = StreamProcessorInput'
  { -- | The Kinesis video stream input stream for the source streaming video.
    StreamProcessorInput -> Maybe KinesisVideoStream
kinesisVideoStream :: Prelude.Maybe KinesisVideoStream
  }
  deriving (StreamProcessorInput -> StreamProcessorInput -> Bool
(StreamProcessorInput -> StreamProcessorInput -> Bool)
-> (StreamProcessorInput -> StreamProcessorInput -> Bool)
-> Eq StreamProcessorInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamProcessorInput -> StreamProcessorInput -> Bool
$c/= :: StreamProcessorInput -> StreamProcessorInput -> Bool
== :: StreamProcessorInput -> StreamProcessorInput -> Bool
$c== :: StreamProcessorInput -> StreamProcessorInput -> Bool
Prelude.Eq, ReadPrec [StreamProcessorInput]
ReadPrec StreamProcessorInput
Int -> ReadS StreamProcessorInput
ReadS [StreamProcessorInput]
(Int -> ReadS StreamProcessorInput)
-> ReadS [StreamProcessorInput]
-> ReadPrec StreamProcessorInput
-> ReadPrec [StreamProcessorInput]
-> Read StreamProcessorInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamProcessorInput]
$creadListPrec :: ReadPrec [StreamProcessorInput]
readPrec :: ReadPrec StreamProcessorInput
$creadPrec :: ReadPrec StreamProcessorInput
readList :: ReadS [StreamProcessorInput]
$creadList :: ReadS [StreamProcessorInput]
readsPrec :: Int -> ReadS StreamProcessorInput
$creadsPrec :: Int -> ReadS StreamProcessorInput
Prelude.Read, Int -> StreamProcessorInput -> ShowS
[StreamProcessorInput] -> ShowS
StreamProcessorInput -> String
(Int -> StreamProcessorInput -> ShowS)
-> (StreamProcessorInput -> String)
-> ([StreamProcessorInput] -> ShowS)
-> Show StreamProcessorInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamProcessorInput] -> ShowS
$cshowList :: [StreamProcessorInput] -> ShowS
show :: StreamProcessorInput -> String
$cshow :: StreamProcessorInput -> String
showsPrec :: Int -> StreamProcessorInput -> ShowS
$cshowsPrec :: Int -> StreamProcessorInput -> ShowS
Prelude.Show, (forall x. StreamProcessorInput -> Rep StreamProcessorInput x)
-> (forall x. Rep StreamProcessorInput x -> StreamProcessorInput)
-> Generic StreamProcessorInput
forall x. Rep StreamProcessorInput x -> StreamProcessorInput
forall x. StreamProcessorInput -> Rep StreamProcessorInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamProcessorInput x -> StreamProcessorInput
$cfrom :: forall x. StreamProcessorInput -> Rep StreamProcessorInput x
Prelude.Generic)

-- |
-- Create a value of 'StreamProcessorInput' 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:
--
-- 'kinesisVideoStream', 'streamProcessorInput_kinesisVideoStream' - The Kinesis video stream input stream for the source streaming video.
newStreamProcessorInput ::
  StreamProcessorInput
newStreamProcessorInput :: StreamProcessorInput
newStreamProcessorInput =
  StreamProcessorInput' :: Maybe KinesisVideoStream -> StreamProcessorInput
StreamProcessorInput'
    { $sel:kinesisVideoStream:StreamProcessorInput' :: Maybe KinesisVideoStream
kinesisVideoStream =
        Maybe KinesisVideoStream
forall a. Maybe a
Prelude.Nothing
    }

-- | The Kinesis video stream input stream for the source streaming video.
streamProcessorInput_kinesisVideoStream :: Lens.Lens' StreamProcessorInput (Prelude.Maybe KinesisVideoStream)
streamProcessorInput_kinesisVideoStream :: (Maybe KinesisVideoStream -> f (Maybe KinesisVideoStream))
-> StreamProcessorInput -> f StreamProcessorInput
streamProcessorInput_kinesisVideoStream = (StreamProcessorInput -> Maybe KinesisVideoStream)
-> (StreamProcessorInput
    -> Maybe KinesisVideoStream -> StreamProcessorInput)
-> Lens
     StreamProcessorInput
     StreamProcessorInput
     (Maybe KinesisVideoStream)
     (Maybe KinesisVideoStream)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamProcessorInput' {Maybe KinesisVideoStream
kinesisVideoStream :: Maybe KinesisVideoStream
$sel:kinesisVideoStream:StreamProcessorInput' :: StreamProcessorInput -> Maybe KinesisVideoStream
kinesisVideoStream} -> Maybe KinesisVideoStream
kinesisVideoStream) (\s :: StreamProcessorInput
s@StreamProcessorInput' {} Maybe KinesisVideoStream
a -> StreamProcessorInput
s {$sel:kinesisVideoStream:StreamProcessorInput' :: Maybe KinesisVideoStream
kinesisVideoStream = Maybe KinesisVideoStream
a} :: StreamProcessorInput)

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

instance Prelude.Hashable StreamProcessorInput

instance Prelude.NFData StreamProcessorInput

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