{-# 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.Chime.Types.SourceConfiguration
-- 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.Chime.Types.SourceConfiguration where

import Amazonka.Chime.Types.SelectedVideoStreams
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Source configuration for a specified media capture pipeline.
--
-- /See:/ 'newSourceConfiguration' smart constructor.
data SourceConfiguration = SourceConfiguration'
  { -- | The selected video streams to capture for a specified media capture
    -- pipeline. The number of video streams can\'t exceed 25.
    SourceConfiguration -> Maybe SelectedVideoStreams
selectedVideoStreams :: Prelude.Maybe SelectedVideoStreams
  }
  deriving (SourceConfiguration -> SourceConfiguration -> Bool
(SourceConfiguration -> SourceConfiguration -> Bool)
-> (SourceConfiguration -> SourceConfiguration -> Bool)
-> Eq SourceConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceConfiguration -> SourceConfiguration -> Bool
$c/= :: SourceConfiguration -> SourceConfiguration -> Bool
== :: SourceConfiguration -> SourceConfiguration -> Bool
$c== :: SourceConfiguration -> SourceConfiguration -> Bool
Prelude.Eq, Int -> SourceConfiguration -> ShowS
[SourceConfiguration] -> ShowS
SourceConfiguration -> String
(Int -> SourceConfiguration -> ShowS)
-> (SourceConfiguration -> String)
-> ([SourceConfiguration] -> ShowS)
-> Show SourceConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceConfiguration] -> ShowS
$cshowList :: [SourceConfiguration] -> ShowS
show :: SourceConfiguration -> String
$cshow :: SourceConfiguration -> String
showsPrec :: Int -> SourceConfiguration -> ShowS
$cshowsPrec :: Int -> SourceConfiguration -> ShowS
Prelude.Show, (forall x. SourceConfiguration -> Rep SourceConfiguration x)
-> (forall x. Rep SourceConfiguration x -> SourceConfiguration)
-> Generic SourceConfiguration
forall x. Rep SourceConfiguration x -> SourceConfiguration
forall x. SourceConfiguration -> Rep SourceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceConfiguration x -> SourceConfiguration
$cfrom :: forall x. SourceConfiguration -> Rep SourceConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SourceConfiguration' 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:
--
-- 'selectedVideoStreams', 'sourceConfiguration_selectedVideoStreams' - The selected video streams to capture for a specified media capture
-- pipeline. The number of video streams can\'t exceed 25.
newSourceConfiguration ::
  SourceConfiguration
newSourceConfiguration :: SourceConfiguration
newSourceConfiguration =
  SourceConfiguration' :: Maybe SelectedVideoStreams -> SourceConfiguration
SourceConfiguration'
    { $sel:selectedVideoStreams:SourceConfiguration' :: Maybe SelectedVideoStreams
selectedVideoStreams =
        Maybe SelectedVideoStreams
forall a. Maybe a
Prelude.Nothing
    }

-- | The selected video streams to capture for a specified media capture
-- pipeline. The number of video streams can\'t exceed 25.
sourceConfiguration_selectedVideoStreams :: Lens.Lens' SourceConfiguration (Prelude.Maybe SelectedVideoStreams)
sourceConfiguration_selectedVideoStreams :: (Maybe SelectedVideoStreams -> f (Maybe SelectedVideoStreams))
-> SourceConfiguration -> f SourceConfiguration
sourceConfiguration_selectedVideoStreams = (SourceConfiguration -> Maybe SelectedVideoStreams)
-> (SourceConfiguration
    -> Maybe SelectedVideoStreams -> SourceConfiguration)
-> Lens
     SourceConfiguration
     SourceConfiguration
     (Maybe SelectedVideoStreams)
     (Maybe SelectedVideoStreams)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceConfiguration' {Maybe SelectedVideoStreams
selectedVideoStreams :: Maybe SelectedVideoStreams
$sel:selectedVideoStreams:SourceConfiguration' :: SourceConfiguration -> Maybe SelectedVideoStreams
selectedVideoStreams} -> Maybe SelectedVideoStreams
selectedVideoStreams) (\s :: SourceConfiguration
s@SourceConfiguration' {} Maybe SelectedVideoStreams
a -> SourceConfiguration
s {$sel:selectedVideoStreams:SourceConfiguration' :: Maybe SelectedVideoStreams
selectedVideoStreams = Maybe SelectedVideoStreams
a} :: SourceConfiguration)

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

instance Prelude.Hashable SourceConfiguration

instance Prelude.NFData SourceConfiguration

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