{-# 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.MediaPackageVOD.Types.StreamSelection
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaPackageVOD.Types.StreamSelection where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaPackageVOD.Types.StreamOrder
import qualified Amazonka.Prelude as Prelude

-- | A StreamSelection configuration.
--
-- /See:/ 'newStreamSelection' smart constructor.
data StreamSelection = StreamSelection'
  { -- | The maximum video bitrate (bps) to include in output.
    StreamSelection -> Maybe Int
maxVideoBitsPerSecond :: Prelude.Maybe Prelude.Int,
    -- | The minimum video bitrate (bps) to include in output.
    StreamSelection -> Maybe Int
minVideoBitsPerSecond :: Prelude.Maybe Prelude.Int,
    -- | A directive that determines the order of streams in the output.
    StreamSelection -> Maybe StreamOrder
streamOrder :: Prelude.Maybe StreamOrder
  }
  deriving (StreamSelection -> StreamSelection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamSelection -> StreamSelection -> Bool
$c/= :: StreamSelection -> StreamSelection -> Bool
== :: StreamSelection -> StreamSelection -> Bool
$c== :: StreamSelection -> StreamSelection -> Bool
Prelude.Eq, ReadPrec [StreamSelection]
ReadPrec StreamSelection
Int -> ReadS StreamSelection
ReadS [StreamSelection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamSelection]
$creadListPrec :: ReadPrec [StreamSelection]
readPrec :: ReadPrec StreamSelection
$creadPrec :: ReadPrec StreamSelection
readList :: ReadS [StreamSelection]
$creadList :: ReadS [StreamSelection]
readsPrec :: Int -> ReadS StreamSelection
$creadsPrec :: Int -> ReadS StreamSelection
Prelude.Read, Int -> StreamSelection -> ShowS
[StreamSelection] -> ShowS
StreamSelection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamSelection] -> ShowS
$cshowList :: [StreamSelection] -> ShowS
show :: StreamSelection -> String
$cshow :: StreamSelection -> String
showsPrec :: Int -> StreamSelection -> ShowS
$cshowsPrec :: Int -> StreamSelection -> ShowS
Prelude.Show, forall x. Rep StreamSelection x -> StreamSelection
forall x. StreamSelection -> Rep StreamSelection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamSelection x -> StreamSelection
$cfrom :: forall x. StreamSelection -> Rep StreamSelection x
Prelude.Generic)

-- |
-- Create a value of 'StreamSelection' 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:
--
-- 'maxVideoBitsPerSecond', 'streamSelection_maxVideoBitsPerSecond' - The maximum video bitrate (bps) to include in output.
--
-- 'minVideoBitsPerSecond', 'streamSelection_minVideoBitsPerSecond' - The minimum video bitrate (bps) to include in output.
--
-- 'streamOrder', 'streamSelection_streamOrder' - A directive that determines the order of streams in the output.
newStreamSelection ::
  StreamSelection
newStreamSelection :: StreamSelection
newStreamSelection =
  StreamSelection'
    { $sel:maxVideoBitsPerSecond:StreamSelection' :: Maybe Int
maxVideoBitsPerSecond =
        forall a. Maybe a
Prelude.Nothing,
      $sel:minVideoBitsPerSecond:StreamSelection' :: Maybe Int
minVideoBitsPerSecond = forall a. Maybe a
Prelude.Nothing,
      $sel:streamOrder:StreamSelection' :: Maybe StreamOrder
streamOrder = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum video bitrate (bps) to include in output.
streamSelection_maxVideoBitsPerSecond :: Lens.Lens' StreamSelection (Prelude.Maybe Prelude.Int)
streamSelection_maxVideoBitsPerSecond :: Lens' StreamSelection (Maybe Int)
streamSelection_maxVideoBitsPerSecond = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamSelection' {Maybe Int
maxVideoBitsPerSecond :: Maybe Int
$sel:maxVideoBitsPerSecond:StreamSelection' :: StreamSelection -> Maybe Int
maxVideoBitsPerSecond} -> Maybe Int
maxVideoBitsPerSecond) (\s :: StreamSelection
s@StreamSelection' {} Maybe Int
a -> StreamSelection
s {$sel:maxVideoBitsPerSecond:StreamSelection' :: Maybe Int
maxVideoBitsPerSecond = Maybe Int
a} :: StreamSelection)

-- | The minimum video bitrate (bps) to include in output.
streamSelection_minVideoBitsPerSecond :: Lens.Lens' StreamSelection (Prelude.Maybe Prelude.Int)
streamSelection_minVideoBitsPerSecond :: Lens' StreamSelection (Maybe Int)
streamSelection_minVideoBitsPerSecond = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamSelection' {Maybe Int
minVideoBitsPerSecond :: Maybe Int
$sel:minVideoBitsPerSecond:StreamSelection' :: StreamSelection -> Maybe Int
minVideoBitsPerSecond} -> Maybe Int
minVideoBitsPerSecond) (\s :: StreamSelection
s@StreamSelection' {} Maybe Int
a -> StreamSelection
s {$sel:minVideoBitsPerSecond:StreamSelection' :: Maybe Int
minVideoBitsPerSecond = Maybe Int
a} :: StreamSelection)

-- | A directive that determines the order of streams in the output.
streamSelection_streamOrder :: Lens.Lens' StreamSelection (Prelude.Maybe StreamOrder)
streamSelection_streamOrder :: Lens' StreamSelection (Maybe StreamOrder)
streamSelection_streamOrder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamSelection' {Maybe StreamOrder
streamOrder :: Maybe StreamOrder
$sel:streamOrder:StreamSelection' :: StreamSelection -> Maybe StreamOrder
streamOrder} -> Maybe StreamOrder
streamOrder) (\s :: StreamSelection
s@StreamSelection' {} Maybe StreamOrder
a -> StreamSelection
s {$sel:streamOrder:StreamSelection' :: Maybe StreamOrder
streamOrder = Maybe StreamOrder
a} :: StreamSelection)

instance Data.FromJSON StreamSelection where
  parseJSON :: Value -> Parser StreamSelection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StreamSelection"
      ( \Object
x ->
          Maybe Int -> Maybe Int -> Maybe StreamOrder -> StreamSelection
StreamSelection'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"maxVideoBitsPerSecond")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"minVideoBitsPerSecond")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"streamOrder")
      )

instance Prelude.Hashable StreamSelection where
  hashWithSalt :: Int -> StreamSelection -> Int
hashWithSalt Int
_salt StreamSelection' {Maybe Int
Maybe StreamOrder
streamOrder :: Maybe StreamOrder
minVideoBitsPerSecond :: Maybe Int
maxVideoBitsPerSecond :: Maybe Int
$sel:streamOrder:StreamSelection' :: StreamSelection -> Maybe StreamOrder
$sel:minVideoBitsPerSecond:StreamSelection' :: StreamSelection -> Maybe Int
$sel:maxVideoBitsPerSecond:StreamSelection' :: StreamSelection -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxVideoBitsPerSecond
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
minVideoBitsPerSecond
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StreamOrder
streamOrder

instance Prelude.NFData StreamSelection where
  rnf :: StreamSelection -> ()
rnf StreamSelection' {Maybe Int
Maybe StreamOrder
streamOrder :: Maybe StreamOrder
minVideoBitsPerSecond :: Maybe Int
maxVideoBitsPerSecond :: Maybe Int
$sel:streamOrder:StreamSelection' :: StreamSelection -> Maybe StreamOrder
$sel:minVideoBitsPerSecond:StreamSelection' :: StreamSelection -> Maybe Int
$sel:maxVideoBitsPerSecond:StreamSelection' :: StreamSelection -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxVideoBitsPerSecond
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
minVideoBitsPerSecond
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StreamOrder
streamOrder

instance Data.ToJSON StreamSelection where
  toJSON :: StreamSelection -> Value
toJSON StreamSelection' {Maybe Int
Maybe StreamOrder
streamOrder :: Maybe StreamOrder
minVideoBitsPerSecond :: Maybe Int
maxVideoBitsPerSecond :: Maybe Int
$sel:streamOrder:StreamSelection' :: StreamSelection -> Maybe StreamOrder
$sel:minVideoBitsPerSecond:StreamSelection' :: StreamSelection -> Maybe Int
$sel:maxVideoBitsPerSecond:StreamSelection' :: StreamSelection -> Maybe Int
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"maxVideoBitsPerSecond" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxVideoBitsPerSecond,
            (Key
"minVideoBitsPerSecond" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
minVideoBitsPerSecond,
            (Key
"streamOrder" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StreamOrder
streamOrder
          ]
      )