{-# 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.MediaConnect.Types.MediaStreamAttributes
-- 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.MediaConnect.Types.MediaStreamAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types.Fmtp
import qualified Amazonka.Prelude as Prelude

-- | Attributes that are related to the media stream.
--
-- /See:/ 'newMediaStreamAttributes' smart constructor.
data MediaStreamAttributes = MediaStreamAttributes'
  { -- | The audio language, in a format that is recognized by the receiver.
    MediaStreamAttributes -> Maybe Text
lang :: Prelude.Maybe Prelude.Text,
    -- | A set of parameters that define the media stream.
    MediaStreamAttributes -> Fmtp
fmtp :: Fmtp
  }
  deriving (MediaStreamAttributes -> MediaStreamAttributes -> Bool
(MediaStreamAttributes -> MediaStreamAttributes -> Bool)
-> (MediaStreamAttributes -> MediaStreamAttributes -> Bool)
-> Eq MediaStreamAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MediaStreamAttributes -> MediaStreamAttributes -> Bool
$c/= :: MediaStreamAttributes -> MediaStreamAttributes -> Bool
== :: MediaStreamAttributes -> MediaStreamAttributes -> Bool
$c== :: MediaStreamAttributes -> MediaStreamAttributes -> Bool
Prelude.Eq, ReadPrec [MediaStreamAttributes]
ReadPrec MediaStreamAttributes
Int -> ReadS MediaStreamAttributes
ReadS [MediaStreamAttributes]
(Int -> ReadS MediaStreamAttributes)
-> ReadS [MediaStreamAttributes]
-> ReadPrec MediaStreamAttributes
-> ReadPrec [MediaStreamAttributes]
-> Read MediaStreamAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MediaStreamAttributes]
$creadListPrec :: ReadPrec [MediaStreamAttributes]
readPrec :: ReadPrec MediaStreamAttributes
$creadPrec :: ReadPrec MediaStreamAttributes
readList :: ReadS [MediaStreamAttributes]
$creadList :: ReadS [MediaStreamAttributes]
readsPrec :: Int -> ReadS MediaStreamAttributes
$creadsPrec :: Int -> ReadS MediaStreamAttributes
Prelude.Read, Int -> MediaStreamAttributes -> ShowS
[MediaStreamAttributes] -> ShowS
MediaStreamAttributes -> String
(Int -> MediaStreamAttributes -> ShowS)
-> (MediaStreamAttributes -> String)
-> ([MediaStreamAttributes] -> ShowS)
-> Show MediaStreamAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MediaStreamAttributes] -> ShowS
$cshowList :: [MediaStreamAttributes] -> ShowS
show :: MediaStreamAttributes -> String
$cshow :: MediaStreamAttributes -> String
showsPrec :: Int -> MediaStreamAttributes -> ShowS
$cshowsPrec :: Int -> MediaStreamAttributes -> ShowS
Prelude.Show, (forall x. MediaStreamAttributes -> Rep MediaStreamAttributes x)
-> (forall x. Rep MediaStreamAttributes x -> MediaStreamAttributes)
-> Generic MediaStreamAttributes
forall x. Rep MediaStreamAttributes x -> MediaStreamAttributes
forall x. MediaStreamAttributes -> Rep MediaStreamAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MediaStreamAttributes x -> MediaStreamAttributes
$cfrom :: forall x. MediaStreamAttributes -> Rep MediaStreamAttributes x
Prelude.Generic)

-- |
-- Create a value of 'MediaStreamAttributes' 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:
--
-- 'lang', 'mediaStreamAttributes_lang' - The audio language, in a format that is recognized by the receiver.
--
-- 'fmtp', 'mediaStreamAttributes_fmtp' - A set of parameters that define the media stream.
newMediaStreamAttributes ::
  -- | 'fmtp'
  Fmtp ->
  MediaStreamAttributes
newMediaStreamAttributes :: Fmtp -> MediaStreamAttributes
newMediaStreamAttributes Fmtp
pFmtp_ =
  MediaStreamAttributes' :: Maybe Text -> Fmtp -> MediaStreamAttributes
MediaStreamAttributes'
    { $sel:lang:MediaStreamAttributes' :: Maybe Text
lang = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fmtp:MediaStreamAttributes' :: Fmtp
fmtp = Fmtp
pFmtp_
    }

-- | The audio language, in a format that is recognized by the receiver.
mediaStreamAttributes_lang :: Lens.Lens' MediaStreamAttributes (Prelude.Maybe Prelude.Text)
mediaStreamAttributes_lang :: (Maybe Text -> f (Maybe Text))
-> MediaStreamAttributes -> f MediaStreamAttributes
mediaStreamAttributes_lang = (MediaStreamAttributes -> Maybe Text)
-> (MediaStreamAttributes -> Maybe Text -> MediaStreamAttributes)
-> Lens
     MediaStreamAttributes
     MediaStreamAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaStreamAttributes' {Maybe Text
lang :: Maybe Text
$sel:lang:MediaStreamAttributes' :: MediaStreamAttributes -> Maybe Text
lang} -> Maybe Text
lang) (\s :: MediaStreamAttributes
s@MediaStreamAttributes' {} Maybe Text
a -> MediaStreamAttributes
s {$sel:lang:MediaStreamAttributes' :: Maybe Text
lang = Maybe Text
a} :: MediaStreamAttributes)

-- | A set of parameters that define the media stream.
mediaStreamAttributes_fmtp :: Lens.Lens' MediaStreamAttributes Fmtp
mediaStreamAttributes_fmtp :: (Fmtp -> f Fmtp)
-> MediaStreamAttributes -> f MediaStreamAttributes
mediaStreamAttributes_fmtp = (MediaStreamAttributes -> Fmtp)
-> (MediaStreamAttributes -> Fmtp -> MediaStreamAttributes)
-> Lens MediaStreamAttributes MediaStreamAttributes Fmtp Fmtp
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaStreamAttributes' {Fmtp
fmtp :: Fmtp
$sel:fmtp:MediaStreamAttributes' :: MediaStreamAttributes -> Fmtp
fmtp} -> Fmtp
fmtp) (\s :: MediaStreamAttributes
s@MediaStreamAttributes' {} Fmtp
a -> MediaStreamAttributes
s {$sel:fmtp:MediaStreamAttributes' :: Fmtp
fmtp = Fmtp
a} :: MediaStreamAttributes)

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

instance Prelude.Hashable MediaStreamAttributes

instance Prelude.NFData MediaStreamAttributes