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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.ArchiveContainerSettings
import qualified Amazonka.Prelude as Prelude

-- | Archive Output Settings
--
-- /See:/ 'newArchiveOutputSettings' smart constructor.
data ArchiveOutputSettings = ArchiveOutputSettings'
  { -- | Output file extension. If excluded, this will be auto-selected from the
    -- container type.
    ArchiveOutputSettings -> Maybe Text
extension :: Prelude.Maybe Prelude.Text,
    -- | String concatenated to the end of the destination filename. Required for
    -- multiple outputs of the same type.
    ArchiveOutputSettings -> Maybe Text
nameModifier :: Prelude.Maybe Prelude.Text,
    -- | Settings specific to the container type of the file.
    ArchiveOutputSettings -> ArchiveContainerSettings
containerSettings :: ArchiveContainerSettings
  }
  deriving (ArchiveOutputSettings -> ArchiveOutputSettings -> Bool
(ArchiveOutputSettings -> ArchiveOutputSettings -> Bool)
-> (ArchiveOutputSettings -> ArchiveOutputSettings -> Bool)
-> Eq ArchiveOutputSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArchiveOutputSettings -> ArchiveOutputSettings -> Bool
$c/= :: ArchiveOutputSettings -> ArchiveOutputSettings -> Bool
== :: ArchiveOutputSettings -> ArchiveOutputSettings -> Bool
$c== :: ArchiveOutputSettings -> ArchiveOutputSettings -> Bool
Prelude.Eq, ReadPrec [ArchiveOutputSettings]
ReadPrec ArchiveOutputSettings
Int -> ReadS ArchiveOutputSettings
ReadS [ArchiveOutputSettings]
(Int -> ReadS ArchiveOutputSettings)
-> ReadS [ArchiveOutputSettings]
-> ReadPrec ArchiveOutputSettings
-> ReadPrec [ArchiveOutputSettings]
-> Read ArchiveOutputSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArchiveOutputSettings]
$creadListPrec :: ReadPrec [ArchiveOutputSettings]
readPrec :: ReadPrec ArchiveOutputSettings
$creadPrec :: ReadPrec ArchiveOutputSettings
readList :: ReadS [ArchiveOutputSettings]
$creadList :: ReadS [ArchiveOutputSettings]
readsPrec :: Int -> ReadS ArchiveOutputSettings
$creadsPrec :: Int -> ReadS ArchiveOutputSettings
Prelude.Read, Int -> ArchiveOutputSettings -> ShowS
[ArchiveOutputSettings] -> ShowS
ArchiveOutputSettings -> String
(Int -> ArchiveOutputSettings -> ShowS)
-> (ArchiveOutputSettings -> String)
-> ([ArchiveOutputSettings] -> ShowS)
-> Show ArchiveOutputSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArchiveOutputSettings] -> ShowS
$cshowList :: [ArchiveOutputSettings] -> ShowS
show :: ArchiveOutputSettings -> String
$cshow :: ArchiveOutputSettings -> String
showsPrec :: Int -> ArchiveOutputSettings -> ShowS
$cshowsPrec :: Int -> ArchiveOutputSettings -> ShowS
Prelude.Show, (forall x. ArchiveOutputSettings -> Rep ArchiveOutputSettings x)
-> (forall x. Rep ArchiveOutputSettings x -> ArchiveOutputSettings)
-> Generic ArchiveOutputSettings
forall x. Rep ArchiveOutputSettings x -> ArchiveOutputSettings
forall x. ArchiveOutputSettings -> Rep ArchiveOutputSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArchiveOutputSettings x -> ArchiveOutputSettings
$cfrom :: forall x. ArchiveOutputSettings -> Rep ArchiveOutputSettings x
Prelude.Generic)

-- |
-- Create a value of 'ArchiveOutputSettings' 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:
--
-- 'extension', 'archiveOutputSettings_extension' - Output file extension. If excluded, this will be auto-selected from the
-- container type.
--
-- 'nameModifier', 'archiveOutputSettings_nameModifier' - String concatenated to the end of the destination filename. Required for
-- multiple outputs of the same type.
--
-- 'containerSettings', 'archiveOutputSettings_containerSettings' - Settings specific to the container type of the file.
newArchiveOutputSettings ::
  -- | 'containerSettings'
  ArchiveContainerSettings ->
  ArchiveOutputSettings
newArchiveOutputSettings :: ArchiveContainerSettings -> ArchiveOutputSettings
newArchiveOutputSettings ArchiveContainerSettings
pContainerSettings_ =
  ArchiveOutputSettings' :: Maybe Text
-> Maybe Text -> ArchiveContainerSettings -> ArchiveOutputSettings
ArchiveOutputSettings'
    { $sel:extension:ArchiveOutputSettings' :: Maybe Text
extension = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nameModifier:ArchiveOutputSettings' :: Maybe Text
nameModifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:containerSettings:ArchiveOutputSettings' :: ArchiveContainerSettings
containerSettings = ArchiveContainerSettings
pContainerSettings_
    }

-- | Output file extension. If excluded, this will be auto-selected from the
-- container type.
archiveOutputSettings_extension :: Lens.Lens' ArchiveOutputSettings (Prelude.Maybe Prelude.Text)
archiveOutputSettings_extension :: (Maybe Text -> f (Maybe Text))
-> ArchiveOutputSettings -> f ArchiveOutputSettings
archiveOutputSettings_extension = (ArchiveOutputSettings -> Maybe Text)
-> (ArchiveOutputSettings -> Maybe Text -> ArchiveOutputSettings)
-> Lens
     ArchiveOutputSettings
     ArchiveOutputSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveOutputSettings' {Maybe Text
extension :: Maybe Text
$sel:extension:ArchiveOutputSettings' :: ArchiveOutputSettings -> Maybe Text
extension} -> Maybe Text
extension) (\s :: ArchiveOutputSettings
s@ArchiveOutputSettings' {} Maybe Text
a -> ArchiveOutputSettings
s {$sel:extension:ArchiveOutputSettings' :: Maybe Text
extension = Maybe Text
a} :: ArchiveOutputSettings)

-- | String concatenated to the end of the destination filename. Required for
-- multiple outputs of the same type.
archiveOutputSettings_nameModifier :: Lens.Lens' ArchiveOutputSettings (Prelude.Maybe Prelude.Text)
archiveOutputSettings_nameModifier :: (Maybe Text -> f (Maybe Text))
-> ArchiveOutputSettings -> f ArchiveOutputSettings
archiveOutputSettings_nameModifier = (ArchiveOutputSettings -> Maybe Text)
-> (ArchiveOutputSettings -> Maybe Text -> ArchiveOutputSettings)
-> Lens
     ArchiveOutputSettings
     ArchiveOutputSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveOutputSettings' {Maybe Text
nameModifier :: Maybe Text
$sel:nameModifier:ArchiveOutputSettings' :: ArchiveOutputSettings -> Maybe Text
nameModifier} -> Maybe Text
nameModifier) (\s :: ArchiveOutputSettings
s@ArchiveOutputSettings' {} Maybe Text
a -> ArchiveOutputSettings
s {$sel:nameModifier:ArchiveOutputSettings' :: Maybe Text
nameModifier = Maybe Text
a} :: ArchiveOutputSettings)

-- | Settings specific to the container type of the file.
archiveOutputSettings_containerSettings :: Lens.Lens' ArchiveOutputSettings ArchiveContainerSettings
archiveOutputSettings_containerSettings :: (ArchiveContainerSettings -> f ArchiveContainerSettings)
-> ArchiveOutputSettings -> f ArchiveOutputSettings
archiveOutputSettings_containerSettings = (ArchiveOutputSettings -> ArchiveContainerSettings)
-> (ArchiveOutputSettings
    -> ArchiveContainerSettings -> ArchiveOutputSettings)
-> Lens
     ArchiveOutputSettings
     ArchiveOutputSettings
     ArchiveContainerSettings
     ArchiveContainerSettings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveOutputSettings' {ArchiveContainerSettings
containerSettings :: ArchiveContainerSettings
$sel:containerSettings:ArchiveOutputSettings' :: ArchiveOutputSettings -> ArchiveContainerSettings
containerSettings} -> ArchiveContainerSettings
containerSettings) (\s :: ArchiveOutputSettings
s@ArchiveOutputSettings' {} ArchiveContainerSettings
a -> ArchiveOutputSettings
s {$sel:containerSettings:ArchiveOutputSettings' :: ArchiveContainerSettings
containerSettings = ArchiveContainerSettings
a} :: ArchiveOutputSettings)

instance Core.FromJSON ArchiveOutputSettings where
  parseJSON :: Value -> Parser ArchiveOutputSettings
parseJSON =
    String
-> (Object -> Parser ArchiveOutputSettings)
-> Value
-> Parser ArchiveOutputSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ArchiveOutputSettings"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> ArchiveContainerSettings -> ArchiveOutputSettings
ArchiveOutputSettings'
            (Maybe Text
 -> Maybe Text -> ArchiveContainerSettings -> ArchiveOutputSettings)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> ArchiveContainerSettings -> ArchiveOutputSettings)
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
"extension")
            Parser
  (Maybe Text -> ArchiveContainerSettings -> ArchiveOutputSettings)
-> Parser (Maybe Text)
-> Parser (ArchiveContainerSettings -> ArchiveOutputSettings)
forall (f :: * -> *) a b. Applicative f => 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
"nameModifier")
            Parser (ArchiveContainerSettings -> ArchiveOutputSettings)
-> Parser ArchiveContainerSettings -> Parser ArchiveOutputSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ArchiveContainerSettings
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"containerSettings")
      )

instance Prelude.Hashable ArchiveOutputSettings

instance Prelude.NFData ArchiveOutputSettings

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