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

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

-- | The video streams to capture for a specified media capture pipeline. The
-- total number of video streams can\'t exceed 25.
--
-- /See:/ 'newSelectedVideoStreams' smart constructor.
data SelectedVideoStreams = SelectedVideoStreams'
  { -- | The attendee IDs of the streams selected for a media capture pipeline.
    SelectedVideoStreams -> Maybe (NonEmpty Text)
attendeeIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The external user IDs of the streams selected for a media capture
    -- pipeline.
    SelectedVideoStreams -> Maybe (NonEmpty (Sensitive Text))
externalUserIds :: Prelude.Maybe (Prelude.NonEmpty (Core.Sensitive Prelude.Text))
  }
  deriving (SelectedVideoStreams -> SelectedVideoStreams -> Bool
(SelectedVideoStreams -> SelectedVideoStreams -> Bool)
-> (SelectedVideoStreams -> SelectedVideoStreams -> Bool)
-> Eq SelectedVideoStreams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectedVideoStreams -> SelectedVideoStreams -> Bool
$c/= :: SelectedVideoStreams -> SelectedVideoStreams -> Bool
== :: SelectedVideoStreams -> SelectedVideoStreams -> Bool
$c== :: SelectedVideoStreams -> SelectedVideoStreams -> Bool
Prelude.Eq, Int -> SelectedVideoStreams -> ShowS
[SelectedVideoStreams] -> ShowS
SelectedVideoStreams -> String
(Int -> SelectedVideoStreams -> ShowS)
-> (SelectedVideoStreams -> String)
-> ([SelectedVideoStreams] -> ShowS)
-> Show SelectedVideoStreams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectedVideoStreams] -> ShowS
$cshowList :: [SelectedVideoStreams] -> ShowS
show :: SelectedVideoStreams -> String
$cshow :: SelectedVideoStreams -> String
showsPrec :: Int -> SelectedVideoStreams -> ShowS
$cshowsPrec :: Int -> SelectedVideoStreams -> ShowS
Prelude.Show, (forall x. SelectedVideoStreams -> Rep SelectedVideoStreams x)
-> (forall x. Rep SelectedVideoStreams x -> SelectedVideoStreams)
-> Generic SelectedVideoStreams
forall x. Rep SelectedVideoStreams x -> SelectedVideoStreams
forall x. SelectedVideoStreams -> Rep SelectedVideoStreams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SelectedVideoStreams x -> SelectedVideoStreams
$cfrom :: forall x. SelectedVideoStreams -> Rep SelectedVideoStreams x
Prelude.Generic)

-- |
-- Create a value of 'SelectedVideoStreams' 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:
--
-- 'attendeeIds', 'selectedVideoStreams_attendeeIds' - The attendee IDs of the streams selected for a media capture pipeline.
--
-- 'externalUserIds', 'selectedVideoStreams_externalUserIds' - The external user IDs of the streams selected for a media capture
-- pipeline.
newSelectedVideoStreams ::
  SelectedVideoStreams
newSelectedVideoStreams :: SelectedVideoStreams
newSelectedVideoStreams =
  SelectedVideoStreams' :: Maybe (NonEmpty Text)
-> Maybe (NonEmpty (Sensitive Text)) -> SelectedVideoStreams
SelectedVideoStreams'
    { $sel:attendeeIds:SelectedVideoStreams' :: Maybe (NonEmpty Text)
attendeeIds =
        Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:externalUserIds:SelectedVideoStreams' :: Maybe (NonEmpty (Sensitive Text))
externalUserIds = Maybe (NonEmpty (Sensitive Text))
forall a. Maybe a
Prelude.Nothing
    }

-- | The attendee IDs of the streams selected for a media capture pipeline.
selectedVideoStreams_attendeeIds :: Lens.Lens' SelectedVideoStreams (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
selectedVideoStreams_attendeeIds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> SelectedVideoStreams -> f SelectedVideoStreams
selectedVideoStreams_attendeeIds = (SelectedVideoStreams -> Maybe (NonEmpty Text))
-> (SelectedVideoStreams
    -> Maybe (NonEmpty Text) -> SelectedVideoStreams)
-> Lens
     SelectedVideoStreams
     SelectedVideoStreams
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectedVideoStreams' {Maybe (NonEmpty Text)
attendeeIds :: Maybe (NonEmpty Text)
$sel:attendeeIds:SelectedVideoStreams' :: SelectedVideoStreams -> Maybe (NonEmpty Text)
attendeeIds} -> Maybe (NonEmpty Text)
attendeeIds) (\s :: SelectedVideoStreams
s@SelectedVideoStreams' {} Maybe (NonEmpty Text)
a -> SelectedVideoStreams
s {$sel:attendeeIds:SelectedVideoStreams' :: Maybe (NonEmpty Text)
attendeeIds = Maybe (NonEmpty Text)
a} :: SelectedVideoStreams) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> SelectedVideoStreams -> f SelectedVideoStreams)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> SelectedVideoStreams
-> f SelectedVideoStreams
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The external user IDs of the streams selected for a media capture
-- pipeline.
selectedVideoStreams_externalUserIds :: Lens.Lens' SelectedVideoStreams (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
selectedVideoStreams_externalUserIds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> SelectedVideoStreams -> f SelectedVideoStreams
selectedVideoStreams_externalUserIds = (SelectedVideoStreams -> Maybe (NonEmpty (Sensitive Text)))
-> (SelectedVideoStreams
    -> Maybe (NonEmpty (Sensitive Text)) -> SelectedVideoStreams)
-> Lens
     SelectedVideoStreams
     SelectedVideoStreams
     (Maybe (NonEmpty (Sensitive Text)))
     (Maybe (NonEmpty (Sensitive Text)))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectedVideoStreams' {Maybe (NonEmpty (Sensitive Text))
externalUserIds :: Maybe (NonEmpty (Sensitive Text))
$sel:externalUserIds:SelectedVideoStreams' :: SelectedVideoStreams -> Maybe (NonEmpty (Sensitive Text))
externalUserIds} -> Maybe (NonEmpty (Sensitive Text))
externalUserIds) (\s :: SelectedVideoStreams
s@SelectedVideoStreams' {} Maybe (NonEmpty (Sensitive Text))
a -> SelectedVideoStreams
s {$sel:externalUserIds:SelectedVideoStreams' :: Maybe (NonEmpty (Sensitive Text))
externalUserIds = Maybe (NonEmpty (Sensitive Text))
a} :: SelectedVideoStreams) ((Maybe (NonEmpty (Sensitive Text))
  -> f (Maybe (NonEmpty (Sensitive Text))))
 -> SelectedVideoStreams -> f SelectedVideoStreams)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty (Sensitive Text))
    -> f (Maybe (NonEmpty (Sensitive Text))))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> SelectedVideoStreams
-> f SelectedVideoStreams
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty (Sensitive Text))
  (NonEmpty (Sensitive Text))
  (NonEmpty Text)
  (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty (Sensitive Text)))
     (Maybe (NonEmpty (Sensitive Text)))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty (Sensitive Text))
  (NonEmpty (Sensitive Text))
  (NonEmpty Text)
  (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable SelectedVideoStreams

instance Prelude.NFData SelectedVideoStreams

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