{-# 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.ElasticTranscoder.Types.InputCaptions
-- 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.ElasticTranscoder.Types.InputCaptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticTranscoder.Types.CaptionSource
import qualified Amazonka.Prelude as Prelude

-- | The captions to be created, if any.
--
-- /See:/ 'newInputCaptions' smart constructor.
data InputCaptions = InputCaptions'
  { -- | Source files for the input sidecar captions used during the transcoding
    -- process. To omit all sidecar captions, leave @CaptionSources@ blank.
    InputCaptions -> Maybe [CaptionSource]
captionSources :: Prelude.Maybe [CaptionSource],
    -- | A policy that determines how Elastic Transcoder handles the existence of
    -- multiple captions.
    --
    -- -   __MergeOverride:__ Elastic Transcoder transcodes both embedded and
    --     sidecar captions into outputs. If captions for a language are
    --     embedded in the input file and also appear in a sidecar file,
    --     Elastic Transcoder uses the sidecar captions and ignores the
    --     embedded captions for that language.
    --
    -- -   __MergeRetain:__ Elastic Transcoder transcodes both embedded and
    --     sidecar captions into outputs. If captions for a language are
    --     embedded in the input file and also appear in a sidecar file,
    --     Elastic Transcoder uses the embedded captions and ignores the
    --     sidecar captions for that language. If @CaptionSources@ is empty,
    --     Elastic Transcoder omits all sidecar captions from the output files.
    --
    -- -   __Override:__ Elastic Transcoder transcodes only the sidecar
    --     captions that you specify in @CaptionSources@.
    --
    -- @MergePolicy@ cannot be null.
    InputCaptions -> Maybe Text
mergePolicy :: Prelude.Maybe Prelude.Text
  }
  deriving (InputCaptions -> InputCaptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputCaptions -> InputCaptions -> Bool
$c/= :: InputCaptions -> InputCaptions -> Bool
== :: InputCaptions -> InputCaptions -> Bool
$c== :: InputCaptions -> InputCaptions -> Bool
Prelude.Eq, ReadPrec [InputCaptions]
ReadPrec InputCaptions
Int -> ReadS InputCaptions
ReadS [InputCaptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputCaptions]
$creadListPrec :: ReadPrec [InputCaptions]
readPrec :: ReadPrec InputCaptions
$creadPrec :: ReadPrec InputCaptions
readList :: ReadS [InputCaptions]
$creadList :: ReadS [InputCaptions]
readsPrec :: Int -> ReadS InputCaptions
$creadsPrec :: Int -> ReadS InputCaptions
Prelude.Read, Int -> InputCaptions -> ShowS
[InputCaptions] -> ShowS
InputCaptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputCaptions] -> ShowS
$cshowList :: [InputCaptions] -> ShowS
show :: InputCaptions -> String
$cshow :: InputCaptions -> String
showsPrec :: Int -> InputCaptions -> ShowS
$cshowsPrec :: Int -> InputCaptions -> ShowS
Prelude.Show, forall x. Rep InputCaptions x -> InputCaptions
forall x. InputCaptions -> Rep InputCaptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputCaptions x -> InputCaptions
$cfrom :: forall x. InputCaptions -> Rep InputCaptions x
Prelude.Generic)

-- |
-- Create a value of 'InputCaptions' 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:
--
-- 'captionSources', 'inputCaptions_captionSources' - Source files for the input sidecar captions used during the transcoding
-- process. To omit all sidecar captions, leave @CaptionSources@ blank.
--
-- 'mergePolicy', 'inputCaptions_mergePolicy' - A policy that determines how Elastic Transcoder handles the existence of
-- multiple captions.
--
-- -   __MergeOverride:__ Elastic Transcoder transcodes both embedded and
--     sidecar captions into outputs. If captions for a language are
--     embedded in the input file and also appear in a sidecar file,
--     Elastic Transcoder uses the sidecar captions and ignores the
--     embedded captions for that language.
--
-- -   __MergeRetain:__ Elastic Transcoder transcodes both embedded and
--     sidecar captions into outputs. If captions for a language are
--     embedded in the input file and also appear in a sidecar file,
--     Elastic Transcoder uses the embedded captions and ignores the
--     sidecar captions for that language. If @CaptionSources@ is empty,
--     Elastic Transcoder omits all sidecar captions from the output files.
--
-- -   __Override:__ Elastic Transcoder transcodes only the sidecar
--     captions that you specify in @CaptionSources@.
--
-- @MergePolicy@ cannot be null.
newInputCaptions ::
  InputCaptions
newInputCaptions :: InputCaptions
newInputCaptions =
  InputCaptions'
    { $sel:captionSources:InputCaptions' :: Maybe [CaptionSource]
captionSources = forall a. Maybe a
Prelude.Nothing,
      $sel:mergePolicy:InputCaptions' :: Maybe Text
mergePolicy = forall a. Maybe a
Prelude.Nothing
    }

-- | Source files for the input sidecar captions used during the transcoding
-- process. To omit all sidecar captions, leave @CaptionSources@ blank.
inputCaptions_captionSources :: Lens.Lens' InputCaptions (Prelude.Maybe [CaptionSource])
inputCaptions_captionSources :: Lens' InputCaptions (Maybe [CaptionSource])
inputCaptions_captionSources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputCaptions' {Maybe [CaptionSource]
captionSources :: Maybe [CaptionSource]
$sel:captionSources:InputCaptions' :: InputCaptions -> Maybe [CaptionSource]
captionSources} -> Maybe [CaptionSource]
captionSources) (\s :: InputCaptions
s@InputCaptions' {} Maybe [CaptionSource]
a -> InputCaptions
s {$sel:captionSources:InputCaptions' :: Maybe [CaptionSource]
captionSources = Maybe [CaptionSource]
a} :: InputCaptions) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A policy that determines how Elastic Transcoder handles the existence of
-- multiple captions.
--
-- -   __MergeOverride:__ Elastic Transcoder transcodes both embedded and
--     sidecar captions into outputs. If captions for a language are
--     embedded in the input file and also appear in a sidecar file,
--     Elastic Transcoder uses the sidecar captions and ignores the
--     embedded captions for that language.
--
-- -   __MergeRetain:__ Elastic Transcoder transcodes both embedded and
--     sidecar captions into outputs. If captions for a language are
--     embedded in the input file and also appear in a sidecar file,
--     Elastic Transcoder uses the embedded captions and ignores the
--     sidecar captions for that language. If @CaptionSources@ is empty,
--     Elastic Transcoder omits all sidecar captions from the output files.
--
-- -   __Override:__ Elastic Transcoder transcodes only the sidecar
--     captions that you specify in @CaptionSources@.
--
-- @MergePolicy@ cannot be null.
inputCaptions_mergePolicy :: Lens.Lens' InputCaptions (Prelude.Maybe Prelude.Text)
inputCaptions_mergePolicy :: Lens' InputCaptions (Maybe Text)
inputCaptions_mergePolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputCaptions' {Maybe Text
mergePolicy :: Maybe Text
$sel:mergePolicy:InputCaptions' :: InputCaptions -> Maybe Text
mergePolicy} -> Maybe Text
mergePolicy) (\s :: InputCaptions
s@InputCaptions' {} Maybe Text
a -> InputCaptions
s {$sel:mergePolicy:InputCaptions' :: Maybe Text
mergePolicy = Maybe Text
a} :: InputCaptions)

instance Data.FromJSON InputCaptions where
  parseJSON :: Value -> Parser InputCaptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputCaptions"
      ( \Object
x ->
          Maybe [CaptionSource] -> Maybe Text -> InputCaptions
InputCaptions'
            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
"CaptionSources" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"MergePolicy")
      )

instance Prelude.Hashable InputCaptions where
  hashWithSalt :: Int -> InputCaptions -> Int
hashWithSalt Int
_salt InputCaptions' {Maybe [CaptionSource]
Maybe Text
mergePolicy :: Maybe Text
captionSources :: Maybe [CaptionSource]
$sel:mergePolicy:InputCaptions' :: InputCaptions -> Maybe Text
$sel:captionSources:InputCaptions' :: InputCaptions -> Maybe [CaptionSource]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [CaptionSource]
captionSources
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
mergePolicy

instance Prelude.NFData InputCaptions where
  rnf :: InputCaptions -> ()
rnf InputCaptions' {Maybe [CaptionSource]
Maybe Text
mergePolicy :: Maybe Text
captionSources :: Maybe [CaptionSource]
$sel:mergePolicy:InputCaptions' :: InputCaptions -> Maybe Text
$sel:captionSources:InputCaptions' :: InputCaptions -> Maybe [CaptionSource]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [CaptionSource]
captionSources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mergePolicy

instance Data.ToJSON InputCaptions where
  toJSON :: InputCaptions -> Value
toJSON InputCaptions' {Maybe [CaptionSource]
Maybe Text
mergePolicy :: Maybe Text
captionSources :: Maybe [CaptionSource]
$sel:mergePolicy:InputCaptions' :: InputCaptions -> Maybe Text
$sel:captionSources:InputCaptions' :: InputCaptions -> Maybe [CaptionSource]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CaptionSources" 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 [CaptionSource]
captionSources,
            (Key
"MergePolicy" 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
mergePolicy
          ]
      )