{-# 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.MediaLive.Types.ArchiveContainerSettings
-- 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.MediaLive.Types.ArchiveContainerSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.M2tsSettings
import Amazonka.MediaLive.Types.RawSettings
import qualified Amazonka.Prelude as Prelude

-- | Archive Container Settings
--
-- /See:/ 'newArchiveContainerSettings' smart constructor.
data ArchiveContainerSettings = ArchiveContainerSettings'
  { ArchiveContainerSettings -> Maybe M2tsSettings
m2tsSettings :: Prelude.Maybe M2tsSettings,
    ArchiveContainerSettings -> Maybe RawSettings
rawSettings :: Prelude.Maybe RawSettings
  }
  deriving (ArchiveContainerSettings -> ArchiveContainerSettings -> Bool
(ArchiveContainerSettings -> ArchiveContainerSettings -> Bool)
-> (ArchiveContainerSettings -> ArchiveContainerSettings -> Bool)
-> Eq ArchiveContainerSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArchiveContainerSettings -> ArchiveContainerSettings -> Bool
$c/= :: ArchiveContainerSettings -> ArchiveContainerSettings -> Bool
== :: ArchiveContainerSettings -> ArchiveContainerSettings -> Bool
$c== :: ArchiveContainerSettings -> ArchiveContainerSettings -> Bool
Prelude.Eq, ReadPrec [ArchiveContainerSettings]
ReadPrec ArchiveContainerSettings
Int -> ReadS ArchiveContainerSettings
ReadS [ArchiveContainerSettings]
(Int -> ReadS ArchiveContainerSettings)
-> ReadS [ArchiveContainerSettings]
-> ReadPrec ArchiveContainerSettings
-> ReadPrec [ArchiveContainerSettings]
-> Read ArchiveContainerSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArchiveContainerSettings]
$creadListPrec :: ReadPrec [ArchiveContainerSettings]
readPrec :: ReadPrec ArchiveContainerSettings
$creadPrec :: ReadPrec ArchiveContainerSettings
readList :: ReadS [ArchiveContainerSettings]
$creadList :: ReadS [ArchiveContainerSettings]
readsPrec :: Int -> ReadS ArchiveContainerSettings
$creadsPrec :: Int -> ReadS ArchiveContainerSettings
Prelude.Read, Int -> ArchiveContainerSettings -> ShowS
[ArchiveContainerSettings] -> ShowS
ArchiveContainerSettings -> String
(Int -> ArchiveContainerSettings -> ShowS)
-> (ArchiveContainerSettings -> String)
-> ([ArchiveContainerSettings] -> ShowS)
-> Show ArchiveContainerSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArchiveContainerSettings] -> ShowS
$cshowList :: [ArchiveContainerSettings] -> ShowS
show :: ArchiveContainerSettings -> String
$cshow :: ArchiveContainerSettings -> String
showsPrec :: Int -> ArchiveContainerSettings -> ShowS
$cshowsPrec :: Int -> ArchiveContainerSettings -> ShowS
Prelude.Show, (forall x.
 ArchiveContainerSettings -> Rep ArchiveContainerSettings x)
-> (forall x.
    Rep ArchiveContainerSettings x -> ArchiveContainerSettings)
-> Generic ArchiveContainerSettings
forall x.
Rep ArchiveContainerSettings x -> ArchiveContainerSettings
forall x.
ArchiveContainerSettings -> Rep ArchiveContainerSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ArchiveContainerSettings x -> ArchiveContainerSettings
$cfrom :: forall x.
ArchiveContainerSettings -> Rep ArchiveContainerSettings x
Prelude.Generic)

-- |
-- Create a value of 'ArchiveContainerSettings' 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:
--
-- 'm2tsSettings', 'archiveContainerSettings_m2tsSettings' - Undocumented member.
--
-- 'rawSettings', 'archiveContainerSettings_rawSettings' - Undocumented member.
newArchiveContainerSettings ::
  ArchiveContainerSettings
newArchiveContainerSettings :: ArchiveContainerSettings
newArchiveContainerSettings =
  ArchiveContainerSettings' :: Maybe M2tsSettings -> Maybe RawSettings -> ArchiveContainerSettings
ArchiveContainerSettings'
    { $sel:m2tsSettings:ArchiveContainerSettings' :: Maybe M2tsSettings
m2tsSettings =
        Maybe M2tsSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:rawSettings:ArchiveContainerSettings' :: Maybe RawSettings
rawSettings = Maybe RawSettings
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
archiveContainerSettings_m2tsSettings :: Lens.Lens' ArchiveContainerSettings (Prelude.Maybe M2tsSettings)
archiveContainerSettings_m2tsSettings :: (Maybe M2tsSettings -> f (Maybe M2tsSettings))
-> ArchiveContainerSettings -> f ArchiveContainerSettings
archiveContainerSettings_m2tsSettings = (ArchiveContainerSettings -> Maybe M2tsSettings)
-> (ArchiveContainerSettings
    -> Maybe M2tsSettings -> ArchiveContainerSettings)
-> Lens
     ArchiveContainerSettings
     ArchiveContainerSettings
     (Maybe M2tsSettings)
     (Maybe M2tsSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveContainerSettings' {Maybe M2tsSettings
m2tsSettings :: Maybe M2tsSettings
$sel:m2tsSettings:ArchiveContainerSettings' :: ArchiveContainerSettings -> Maybe M2tsSettings
m2tsSettings} -> Maybe M2tsSettings
m2tsSettings) (\s :: ArchiveContainerSettings
s@ArchiveContainerSettings' {} Maybe M2tsSettings
a -> ArchiveContainerSettings
s {$sel:m2tsSettings:ArchiveContainerSettings' :: Maybe M2tsSettings
m2tsSettings = Maybe M2tsSettings
a} :: ArchiveContainerSettings)

-- | Undocumented member.
archiveContainerSettings_rawSettings :: Lens.Lens' ArchiveContainerSettings (Prelude.Maybe RawSettings)
archiveContainerSettings_rawSettings :: (Maybe RawSettings -> f (Maybe RawSettings))
-> ArchiveContainerSettings -> f ArchiveContainerSettings
archiveContainerSettings_rawSettings = (ArchiveContainerSettings -> Maybe RawSettings)
-> (ArchiveContainerSettings
    -> Maybe RawSettings -> ArchiveContainerSettings)
-> Lens
     ArchiveContainerSettings
     ArchiveContainerSettings
     (Maybe RawSettings)
     (Maybe RawSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveContainerSettings' {Maybe RawSettings
rawSettings :: Maybe RawSettings
$sel:rawSettings:ArchiveContainerSettings' :: ArchiveContainerSettings -> Maybe RawSettings
rawSettings} -> Maybe RawSettings
rawSettings) (\s :: ArchiveContainerSettings
s@ArchiveContainerSettings' {} Maybe RawSettings
a -> ArchiveContainerSettings
s {$sel:rawSettings:ArchiveContainerSettings' :: Maybe RawSettings
rawSettings = Maybe RawSettings
a} :: ArchiveContainerSettings)

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

instance Prelude.Hashable ArchiveContainerSettings

instance Prelude.NFData ArchiveContainerSettings

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