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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:extension:ArchiveOutputSettings' :: Maybe Text
extension = forall a. Maybe a
Prelude.Nothing,
      $sel:nameModifier:ArchiveOutputSettings' :: Maybe Text
nameModifier = 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 :: Lens' ArchiveOutputSettings (Maybe Text)
archiveOutputSettings_extension = 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 :: Lens' ArchiveOutputSettings (Maybe Text)
archiveOutputSettings_nameModifier = 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 :: Lens' ArchiveOutputSettings ArchiveContainerSettings
archiveOutputSettings_containerSettings = 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 Data.FromJSON ArchiveOutputSettings where
  parseJSON :: Value -> Parser ArchiveOutputSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ArchiveOutputSettings"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> ArchiveContainerSettings -> ArchiveOutputSettings
ArchiveOutputSettings'
            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
"extension")
            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
"nameModifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"containerSettings")
      )

instance Prelude.Hashable ArchiveOutputSettings where
  hashWithSalt :: Int -> ArchiveOutputSettings -> Int
hashWithSalt Int
_salt 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
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
extension
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nameModifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ArchiveContainerSettings
containerSettings

instance Prelude.NFData ArchiveOutputSettings where
  rnf :: ArchiveOutputSettings -> ()
rnf 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
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
extension
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nameModifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ArchiveContainerSettings
containerSettings

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"extension" 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 Text
extension,
            (Key
"nameModifier" 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 Text
nameModifier,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"containerSettings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ArchiveContainerSettings
containerSettings)
          ]
      )