{-# 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.MediaConvert.Types.FileGroupSettings
-- 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.MediaConvert.Types.FileGroupSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaConvert.Types.DestinationSettings
import qualified Amazonka.Prelude as Prelude

-- | Settings related to your File output group. MediaConvert uses this group
-- of settings to generate a single standalone file, rather than a
-- streaming package. When you work directly in your JSON job
-- specification, include this object and any required children when you
-- set Type, under OutputGroupSettings, to FILE_GROUP_SETTINGS.
--
-- /See:/ 'newFileGroupSettings' smart constructor.
data FileGroupSettings = FileGroupSettings'
  { -- | Use Destination (Destination) to specify the S3 output location and the
    -- output filename base. Destination accepts format identifiers. If you do
    -- not specify the base filename in the URI, the service will use the
    -- filename of the input file. If your job has multiple inputs, the service
    -- uses the filename of the first input file.
    FileGroupSettings -> Maybe Text
destination :: Prelude.Maybe Prelude.Text,
    -- | Settings associated with the destination. Will vary based on the type of
    -- destination
    FileGroupSettings -> Maybe DestinationSettings
destinationSettings :: Prelude.Maybe DestinationSettings
  }
  deriving (FileGroupSettings -> FileGroupSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileGroupSettings -> FileGroupSettings -> Bool
$c/= :: FileGroupSettings -> FileGroupSettings -> Bool
== :: FileGroupSettings -> FileGroupSettings -> Bool
$c== :: FileGroupSettings -> FileGroupSettings -> Bool
Prelude.Eq, ReadPrec [FileGroupSettings]
ReadPrec FileGroupSettings
Int -> ReadS FileGroupSettings
ReadS [FileGroupSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileGroupSettings]
$creadListPrec :: ReadPrec [FileGroupSettings]
readPrec :: ReadPrec FileGroupSettings
$creadPrec :: ReadPrec FileGroupSettings
readList :: ReadS [FileGroupSettings]
$creadList :: ReadS [FileGroupSettings]
readsPrec :: Int -> ReadS FileGroupSettings
$creadsPrec :: Int -> ReadS FileGroupSettings
Prelude.Read, Int -> FileGroupSettings -> ShowS
[FileGroupSettings] -> ShowS
FileGroupSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileGroupSettings] -> ShowS
$cshowList :: [FileGroupSettings] -> ShowS
show :: FileGroupSettings -> String
$cshow :: FileGroupSettings -> String
showsPrec :: Int -> FileGroupSettings -> ShowS
$cshowsPrec :: Int -> FileGroupSettings -> ShowS
Prelude.Show, forall x. Rep FileGroupSettings x -> FileGroupSettings
forall x. FileGroupSettings -> Rep FileGroupSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileGroupSettings x -> FileGroupSettings
$cfrom :: forall x. FileGroupSettings -> Rep FileGroupSettings x
Prelude.Generic)

-- |
-- Create a value of 'FileGroupSettings' 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:
--
-- 'destination', 'fileGroupSettings_destination' - Use Destination (Destination) to specify the S3 output location and the
-- output filename base. Destination accepts format identifiers. If you do
-- not specify the base filename in the URI, the service will use the
-- filename of the input file. If your job has multiple inputs, the service
-- uses the filename of the first input file.
--
-- 'destinationSettings', 'fileGroupSettings_destinationSettings' - Settings associated with the destination. Will vary based on the type of
-- destination
newFileGroupSettings ::
  FileGroupSettings
newFileGroupSettings :: FileGroupSettings
newFileGroupSettings =
  FileGroupSettings'
    { $sel:destination:FileGroupSettings' :: Maybe Text
destination = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationSettings:FileGroupSettings' :: Maybe DestinationSettings
destinationSettings = forall a. Maybe a
Prelude.Nothing
    }

-- | Use Destination (Destination) to specify the S3 output location and the
-- output filename base. Destination accepts format identifiers. If you do
-- not specify the base filename in the URI, the service will use the
-- filename of the input file. If your job has multiple inputs, the service
-- uses the filename of the first input file.
fileGroupSettings_destination :: Lens.Lens' FileGroupSettings (Prelude.Maybe Prelude.Text)
fileGroupSettings_destination :: Lens' FileGroupSettings (Maybe Text)
fileGroupSettings_destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileGroupSettings' {Maybe Text
destination :: Maybe Text
$sel:destination:FileGroupSettings' :: FileGroupSettings -> Maybe Text
destination} -> Maybe Text
destination) (\s :: FileGroupSettings
s@FileGroupSettings' {} Maybe Text
a -> FileGroupSettings
s {$sel:destination:FileGroupSettings' :: Maybe Text
destination = Maybe Text
a} :: FileGroupSettings)

-- | Settings associated with the destination. Will vary based on the type of
-- destination
fileGroupSettings_destinationSettings :: Lens.Lens' FileGroupSettings (Prelude.Maybe DestinationSettings)
fileGroupSettings_destinationSettings :: Lens' FileGroupSettings (Maybe DestinationSettings)
fileGroupSettings_destinationSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileGroupSettings' {Maybe DestinationSettings
destinationSettings :: Maybe DestinationSettings
$sel:destinationSettings:FileGroupSettings' :: FileGroupSettings -> Maybe DestinationSettings
destinationSettings} -> Maybe DestinationSettings
destinationSettings) (\s :: FileGroupSettings
s@FileGroupSettings' {} Maybe DestinationSettings
a -> FileGroupSettings
s {$sel:destinationSettings:FileGroupSettings' :: Maybe DestinationSettings
destinationSettings = Maybe DestinationSettings
a} :: FileGroupSettings)

instance Data.FromJSON FileGroupSettings where
  parseJSON :: Value -> Parser FileGroupSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FileGroupSettings"
      ( \Object
x ->
          Maybe Text -> Maybe DestinationSettings -> FileGroupSettings
FileGroupSettings'
            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
"destination")
            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
"destinationSettings")
      )

instance Prelude.Hashable FileGroupSettings where
  hashWithSalt :: Int -> FileGroupSettings -> Int
hashWithSalt Int
_salt FileGroupSettings' {Maybe Text
Maybe DestinationSettings
destinationSettings :: Maybe DestinationSettings
destination :: Maybe Text
$sel:destinationSettings:FileGroupSettings' :: FileGroupSettings -> Maybe DestinationSettings
$sel:destination:FileGroupSettings' :: FileGroupSettings -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DestinationSettings
destinationSettings

instance Prelude.NFData FileGroupSettings where
  rnf :: FileGroupSettings -> ()
rnf FileGroupSettings' {Maybe Text
Maybe DestinationSettings
destinationSettings :: Maybe DestinationSettings
destination :: Maybe Text
$sel:destinationSettings:FileGroupSettings' :: FileGroupSettings -> Maybe DestinationSettings
$sel:destination:FileGroupSettings' :: FileGroupSettings -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DestinationSettings
destinationSettings

instance Data.ToJSON FileGroupSettings where
  toJSON :: FileGroupSettings -> Value
toJSON FileGroupSettings' {Maybe Text
Maybe DestinationSettings
destinationSettings :: Maybe DestinationSettings
destination :: Maybe Text
$sel:destinationSettings:FileGroupSettings' :: FileGroupSettings -> Maybe DestinationSettings
$sel:destination:FileGroupSettings' :: FileGroupSettings -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"destination" 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
destination,
            (Key
"destinationSettings" 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 DestinationSettings
destinationSettings
          ]
      )