{-# 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.MediaPackage.Types.MssPackage
-- 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.MediaPackage.Types.MssPackage where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaPackage.Types.MssEncryption
import Amazonka.MediaPackage.Types.StreamSelection
import qualified Amazonka.Prelude as Prelude

-- | A Microsoft Smooth Streaming (MSS) packaging configuration.
--
-- /See:/ 'newMssPackage' smart constructor.
data MssPackage = MssPackage'
  { MssPackage -> Maybe MssEncryption
encryption :: Prelude.Maybe MssEncryption,
    -- | The time window (in seconds) contained in each manifest.
    MssPackage -> Maybe Int
manifestWindowSeconds :: Prelude.Maybe Prelude.Int,
    -- | The duration (in seconds) of each segment.
    MssPackage -> Maybe Int
segmentDurationSeconds :: Prelude.Maybe Prelude.Int,
    MssPackage -> Maybe StreamSelection
streamSelection :: Prelude.Maybe StreamSelection
  }
  deriving (MssPackage -> MssPackage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MssPackage -> MssPackage -> Bool
$c/= :: MssPackage -> MssPackage -> Bool
== :: MssPackage -> MssPackage -> Bool
$c== :: MssPackage -> MssPackage -> Bool
Prelude.Eq, ReadPrec [MssPackage]
ReadPrec MssPackage
Int -> ReadS MssPackage
ReadS [MssPackage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MssPackage]
$creadListPrec :: ReadPrec [MssPackage]
readPrec :: ReadPrec MssPackage
$creadPrec :: ReadPrec MssPackage
readList :: ReadS [MssPackage]
$creadList :: ReadS [MssPackage]
readsPrec :: Int -> ReadS MssPackage
$creadsPrec :: Int -> ReadS MssPackage
Prelude.Read, Int -> MssPackage -> ShowS
[MssPackage] -> ShowS
MssPackage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MssPackage] -> ShowS
$cshowList :: [MssPackage] -> ShowS
show :: MssPackage -> String
$cshow :: MssPackage -> String
showsPrec :: Int -> MssPackage -> ShowS
$cshowsPrec :: Int -> MssPackage -> ShowS
Prelude.Show, forall x. Rep MssPackage x -> MssPackage
forall x. MssPackage -> Rep MssPackage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MssPackage x -> MssPackage
$cfrom :: forall x. MssPackage -> Rep MssPackage x
Prelude.Generic)

-- |
-- Create a value of 'MssPackage' 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:
--
-- 'encryption', 'mssPackage_encryption' - Undocumented member.
--
-- 'manifestWindowSeconds', 'mssPackage_manifestWindowSeconds' - The time window (in seconds) contained in each manifest.
--
-- 'segmentDurationSeconds', 'mssPackage_segmentDurationSeconds' - The duration (in seconds) of each segment.
--
-- 'streamSelection', 'mssPackage_streamSelection' - Undocumented member.
newMssPackage ::
  MssPackage
newMssPackage :: MssPackage
newMssPackage =
  MssPackage'
    { $sel:encryption:MssPackage' :: Maybe MssEncryption
encryption = forall a. Maybe a
Prelude.Nothing,
      $sel:manifestWindowSeconds:MssPackage' :: Maybe Int
manifestWindowSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:segmentDurationSeconds:MssPackage' :: Maybe Int
segmentDurationSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:streamSelection:MssPackage' :: Maybe StreamSelection
streamSelection = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
mssPackage_encryption :: Lens.Lens' MssPackage (Prelude.Maybe MssEncryption)
mssPackage_encryption :: Lens' MssPackage (Maybe MssEncryption)
mssPackage_encryption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MssPackage' {Maybe MssEncryption
encryption :: Maybe MssEncryption
$sel:encryption:MssPackage' :: MssPackage -> Maybe MssEncryption
encryption} -> Maybe MssEncryption
encryption) (\s :: MssPackage
s@MssPackage' {} Maybe MssEncryption
a -> MssPackage
s {$sel:encryption:MssPackage' :: Maybe MssEncryption
encryption = Maybe MssEncryption
a} :: MssPackage)

-- | The time window (in seconds) contained in each manifest.
mssPackage_manifestWindowSeconds :: Lens.Lens' MssPackage (Prelude.Maybe Prelude.Int)
mssPackage_manifestWindowSeconds :: Lens' MssPackage (Maybe Int)
mssPackage_manifestWindowSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MssPackage' {Maybe Int
manifestWindowSeconds :: Maybe Int
$sel:manifestWindowSeconds:MssPackage' :: MssPackage -> Maybe Int
manifestWindowSeconds} -> Maybe Int
manifestWindowSeconds) (\s :: MssPackage
s@MssPackage' {} Maybe Int
a -> MssPackage
s {$sel:manifestWindowSeconds:MssPackage' :: Maybe Int
manifestWindowSeconds = Maybe Int
a} :: MssPackage)

-- | The duration (in seconds) of each segment.
mssPackage_segmentDurationSeconds :: Lens.Lens' MssPackage (Prelude.Maybe Prelude.Int)
mssPackage_segmentDurationSeconds :: Lens' MssPackage (Maybe Int)
mssPackage_segmentDurationSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MssPackage' {Maybe Int
segmentDurationSeconds :: Maybe Int
$sel:segmentDurationSeconds:MssPackage' :: MssPackage -> Maybe Int
segmentDurationSeconds} -> Maybe Int
segmentDurationSeconds) (\s :: MssPackage
s@MssPackage' {} Maybe Int
a -> MssPackage
s {$sel:segmentDurationSeconds:MssPackage' :: Maybe Int
segmentDurationSeconds = Maybe Int
a} :: MssPackage)

-- | Undocumented member.
mssPackage_streamSelection :: Lens.Lens' MssPackage (Prelude.Maybe StreamSelection)
mssPackage_streamSelection :: Lens' MssPackage (Maybe StreamSelection)
mssPackage_streamSelection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MssPackage' {Maybe StreamSelection
streamSelection :: Maybe StreamSelection
$sel:streamSelection:MssPackage' :: MssPackage -> Maybe StreamSelection
streamSelection} -> Maybe StreamSelection
streamSelection) (\s :: MssPackage
s@MssPackage' {} Maybe StreamSelection
a -> MssPackage
s {$sel:streamSelection:MssPackage' :: Maybe StreamSelection
streamSelection = Maybe StreamSelection
a} :: MssPackage)

instance Data.FromJSON MssPackage where
  parseJSON :: Value -> Parser MssPackage
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MssPackage"
      ( \Object
x ->
          Maybe MssEncryption
-> Maybe Int -> Maybe Int -> Maybe StreamSelection -> MssPackage
MssPackage'
            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
"encryption")
            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
"manifestWindowSeconds")
            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
"segmentDurationSeconds")
            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
"streamSelection")
      )

instance Prelude.Hashable MssPackage where
  hashWithSalt :: Int -> MssPackage -> Int
hashWithSalt Int
_salt MssPackage' {Maybe Int
Maybe MssEncryption
Maybe StreamSelection
streamSelection :: Maybe StreamSelection
segmentDurationSeconds :: Maybe Int
manifestWindowSeconds :: Maybe Int
encryption :: Maybe MssEncryption
$sel:streamSelection:MssPackage' :: MssPackage -> Maybe StreamSelection
$sel:segmentDurationSeconds:MssPackage' :: MssPackage -> Maybe Int
$sel:manifestWindowSeconds:MssPackage' :: MssPackage -> Maybe Int
$sel:encryption:MssPackage' :: MssPackage -> Maybe MssEncryption
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MssEncryption
encryption
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
manifestWindowSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
segmentDurationSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StreamSelection
streamSelection

instance Prelude.NFData MssPackage where
  rnf :: MssPackage -> ()
rnf MssPackage' {Maybe Int
Maybe MssEncryption
Maybe StreamSelection
streamSelection :: Maybe StreamSelection
segmentDurationSeconds :: Maybe Int
manifestWindowSeconds :: Maybe Int
encryption :: Maybe MssEncryption
$sel:streamSelection:MssPackage' :: MssPackage -> Maybe StreamSelection
$sel:segmentDurationSeconds:MssPackage' :: MssPackage -> Maybe Int
$sel:manifestWindowSeconds:MssPackage' :: MssPackage -> Maybe Int
$sel:encryption:MssPackage' :: MssPackage -> Maybe MssEncryption
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe MssEncryption
encryption
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
manifestWindowSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
segmentDurationSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StreamSelection
streamSelection

instance Data.ToJSON MssPackage where
  toJSON :: MssPackage -> Value
toJSON MssPackage' {Maybe Int
Maybe MssEncryption
Maybe StreamSelection
streamSelection :: Maybe StreamSelection
segmentDurationSeconds :: Maybe Int
manifestWindowSeconds :: Maybe Int
encryption :: Maybe MssEncryption
$sel:streamSelection:MssPackage' :: MssPackage -> Maybe StreamSelection
$sel:segmentDurationSeconds:MssPackage' :: MssPackage -> Maybe Int
$sel:manifestWindowSeconds:MssPackage' :: MssPackage -> Maybe Int
$sel:encryption:MssPackage' :: MssPackage -> Maybe MssEncryption
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"encryption" 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 MssEncryption
encryption,
            (Key
"manifestWindowSeconds" 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
manifestWindowSeconds,
            (Key
"segmentDurationSeconds" 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
segmentDurationSeconds,
            (Key
"streamSelection" 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 StreamSelection
streamSelection
          ]
      )