{-# 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.CaptionSelector
-- 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.CaptionSelector 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.CaptionSourceSettings
import Amazonka.MediaConvert.Types.LanguageCode
import qualified Amazonka.Prelude as Prelude

-- | Use captions selectors to specify the captions data from your input that
-- you use in your outputs. You can use up to 20 captions selectors per
-- input.
--
-- /See:/ 'newCaptionSelector' smart constructor.
data CaptionSelector = CaptionSelector'
  { -- | The specific language to extract from source, using the ISO 639-2 or ISO
    -- 639-3 three-letter language code. If input is SCTE-27, complete this
    -- field and\/or PID to select the caption language to extract. If input is
    -- DVB-Sub and output is Burn-in or SMPTE-TT, complete this field and\/or
    -- PID to select the caption language to extract. If input is DVB-Sub that
    -- is being passed through, omit this field (and PID field); there is no
    -- way to extract a specific language with pass-through captions.
    CaptionSelector -> Maybe Text
customLanguageCode :: Prelude.Maybe Prelude.Text,
    -- | The specific language to extract from source. If input is SCTE-27,
    -- complete this field and\/or PID to select the caption language to
    -- extract. If input is DVB-Sub and output is Burn-in or SMPTE-TT, complete
    -- this field and\/or PID to select the caption language to extract. If
    -- input is DVB-Sub that is being passed through, omit this field (and PID
    -- field); there is no way to extract a specific language with pass-through
    -- captions.
    CaptionSelector -> Maybe LanguageCode
languageCode :: Prelude.Maybe LanguageCode,
    -- | If your input captions are SCC, TTML, STL, SMI, SRT, or IMSC in an xml
    -- file, specify the URI of the input captions source file. If your input
    -- captions are IMSC in an IMF package, use TrackSourceSettings instead of
    -- FileSoureSettings.
    CaptionSelector -> Maybe CaptionSourceSettings
sourceSettings :: Prelude.Maybe CaptionSourceSettings
  }
  deriving (CaptionSelector -> CaptionSelector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CaptionSelector -> CaptionSelector -> Bool
$c/= :: CaptionSelector -> CaptionSelector -> Bool
== :: CaptionSelector -> CaptionSelector -> Bool
$c== :: CaptionSelector -> CaptionSelector -> Bool
Prelude.Eq, ReadPrec [CaptionSelector]
ReadPrec CaptionSelector
Int -> ReadS CaptionSelector
ReadS [CaptionSelector]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CaptionSelector]
$creadListPrec :: ReadPrec [CaptionSelector]
readPrec :: ReadPrec CaptionSelector
$creadPrec :: ReadPrec CaptionSelector
readList :: ReadS [CaptionSelector]
$creadList :: ReadS [CaptionSelector]
readsPrec :: Int -> ReadS CaptionSelector
$creadsPrec :: Int -> ReadS CaptionSelector
Prelude.Read, Int -> CaptionSelector -> ShowS
[CaptionSelector] -> ShowS
CaptionSelector -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaptionSelector] -> ShowS
$cshowList :: [CaptionSelector] -> ShowS
show :: CaptionSelector -> String
$cshow :: CaptionSelector -> String
showsPrec :: Int -> CaptionSelector -> ShowS
$cshowsPrec :: Int -> CaptionSelector -> ShowS
Prelude.Show, forall x. Rep CaptionSelector x -> CaptionSelector
forall x. CaptionSelector -> Rep CaptionSelector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CaptionSelector x -> CaptionSelector
$cfrom :: forall x. CaptionSelector -> Rep CaptionSelector x
Prelude.Generic)

-- |
-- Create a value of 'CaptionSelector' 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:
--
-- 'customLanguageCode', 'captionSelector_customLanguageCode' - The specific language to extract from source, using the ISO 639-2 or ISO
-- 639-3 three-letter language code. If input is SCTE-27, complete this
-- field and\/or PID to select the caption language to extract. If input is
-- DVB-Sub and output is Burn-in or SMPTE-TT, complete this field and\/or
-- PID to select the caption language to extract. If input is DVB-Sub that
-- is being passed through, omit this field (and PID field); there is no
-- way to extract a specific language with pass-through captions.
--
-- 'languageCode', 'captionSelector_languageCode' - The specific language to extract from source. If input is SCTE-27,
-- complete this field and\/or PID to select the caption language to
-- extract. If input is DVB-Sub and output is Burn-in or SMPTE-TT, complete
-- this field and\/or PID to select the caption language to extract. If
-- input is DVB-Sub that is being passed through, omit this field (and PID
-- field); there is no way to extract a specific language with pass-through
-- captions.
--
-- 'sourceSettings', 'captionSelector_sourceSettings' - If your input captions are SCC, TTML, STL, SMI, SRT, or IMSC in an xml
-- file, specify the URI of the input captions source file. If your input
-- captions are IMSC in an IMF package, use TrackSourceSettings instead of
-- FileSoureSettings.
newCaptionSelector ::
  CaptionSelector
newCaptionSelector :: CaptionSelector
newCaptionSelector =
  CaptionSelector'
    { $sel:customLanguageCode:CaptionSelector' :: Maybe Text
customLanguageCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:CaptionSelector' :: Maybe LanguageCode
languageCode = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceSettings:CaptionSelector' :: Maybe CaptionSourceSettings
sourceSettings = forall a. Maybe a
Prelude.Nothing
    }

-- | The specific language to extract from source, using the ISO 639-2 or ISO
-- 639-3 three-letter language code. If input is SCTE-27, complete this
-- field and\/or PID to select the caption language to extract. If input is
-- DVB-Sub and output is Burn-in or SMPTE-TT, complete this field and\/or
-- PID to select the caption language to extract. If input is DVB-Sub that
-- is being passed through, omit this field (and PID field); there is no
-- way to extract a specific language with pass-through captions.
captionSelector_customLanguageCode :: Lens.Lens' CaptionSelector (Prelude.Maybe Prelude.Text)
captionSelector_customLanguageCode :: Lens' CaptionSelector (Maybe Text)
captionSelector_customLanguageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSelector' {Maybe Text
customLanguageCode :: Maybe Text
$sel:customLanguageCode:CaptionSelector' :: CaptionSelector -> Maybe Text
customLanguageCode} -> Maybe Text
customLanguageCode) (\s :: CaptionSelector
s@CaptionSelector' {} Maybe Text
a -> CaptionSelector
s {$sel:customLanguageCode:CaptionSelector' :: Maybe Text
customLanguageCode = Maybe Text
a} :: CaptionSelector)

-- | The specific language to extract from source. If input is SCTE-27,
-- complete this field and\/or PID to select the caption language to
-- extract. If input is DVB-Sub and output is Burn-in or SMPTE-TT, complete
-- this field and\/or PID to select the caption language to extract. If
-- input is DVB-Sub that is being passed through, omit this field (and PID
-- field); there is no way to extract a specific language with pass-through
-- captions.
captionSelector_languageCode :: Lens.Lens' CaptionSelector (Prelude.Maybe LanguageCode)
captionSelector_languageCode :: Lens' CaptionSelector (Maybe LanguageCode)
captionSelector_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSelector' {Maybe LanguageCode
languageCode :: Maybe LanguageCode
$sel:languageCode:CaptionSelector' :: CaptionSelector -> Maybe LanguageCode
languageCode} -> Maybe LanguageCode
languageCode) (\s :: CaptionSelector
s@CaptionSelector' {} Maybe LanguageCode
a -> CaptionSelector
s {$sel:languageCode:CaptionSelector' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
a} :: CaptionSelector)

-- | If your input captions are SCC, TTML, STL, SMI, SRT, or IMSC in an xml
-- file, specify the URI of the input captions source file. If your input
-- captions are IMSC in an IMF package, use TrackSourceSettings instead of
-- FileSoureSettings.
captionSelector_sourceSettings :: Lens.Lens' CaptionSelector (Prelude.Maybe CaptionSourceSettings)
captionSelector_sourceSettings :: Lens' CaptionSelector (Maybe CaptionSourceSettings)
captionSelector_sourceSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSelector' {Maybe CaptionSourceSettings
sourceSettings :: Maybe CaptionSourceSettings
$sel:sourceSettings:CaptionSelector' :: CaptionSelector -> Maybe CaptionSourceSettings
sourceSettings} -> Maybe CaptionSourceSettings
sourceSettings) (\s :: CaptionSelector
s@CaptionSelector' {} Maybe CaptionSourceSettings
a -> CaptionSelector
s {$sel:sourceSettings:CaptionSelector' :: Maybe CaptionSourceSettings
sourceSettings = Maybe CaptionSourceSettings
a} :: CaptionSelector)

instance Data.FromJSON CaptionSelector where
  parseJSON :: Value -> Parser CaptionSelector
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CaptionSelector"
      ( \Object
x ->
          Maybe Text
-> Maybe LanguageCode
-> Maybe CaptionSourceSettings
-> CaptionSelector
CaptionSelector'
            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
"customLanguageCode")
            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
"languageCode")
            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
"sourceSettings")
      )

instance Prelude.Hashable CaptionSelector where
  hashWithSalt :: Int -> CaptionSelector -> Int
hashWithSalt Int
_salt CaptionSelector' {Maybe Text
Maybe LanguageCode
Maybe CaptionSourceSettings
sourceSettings :: Maybe CaptionSourceSettings
languageCode :: Maybe LanguageCode
customLanguageCode :: Maybe Text
$sel:sourceSettings:CaptionSelector' :: CaptionSelector -> Maybe CaptionSourceSettings
$sel:languageCode:CaptionSelector' :: CaptionSelector -> Maybe LanguageCode
$sel:customLanguageCode:CaptionSelector' :: CaptionSelector -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customLanguageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LanguageCode
languageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CaptionSourceSettings
sourceSettings

instance Prelude.NFData CaptionSelector where
  rnf :: CaptionSelector -> ()
rnf CaptionSelector' {Maybe Text
Maybe LanguageCode
Maybe CaptionSourceSettings
sourceSettings :: Maybe CaptionSourceSettings
languageCode :: Maybe LanguageCode
customLanguageCode :: Maybe Text
$sel:sourceSettings:CaptionSelector' :: CaptionSelector -> Maybe CaptionSourceSettings
$sel:languageCode:CaptionSelector' :: CaptionSelector -> Maybe LanguageCode
$sel:customLanguageCode:CaptionSelector' :: CaptionSelector -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customLanguageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LanguageCode
languageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CaptionSourceSettings
sourceSettings

instance Data.ToJSON CaptionSelector where
  toJSON :: CaptionSelector -> Value
toJSON CaptionSelector' {Maybe Text
Maybe LanguageCode
Maybe CaptionSourceSettings
sourceSettings :: Maybe CaptionSourceSettings
languageCode :: Maybe LanguageCode
customLanguageCode :: Maybe Text
$sel:sourceSettings:CaptionSelector' :: CaptionSelector -> Maybe CaptionSourceSettings
$sel:languageCode:CaptionSelector' :: CaptionSelector -> Maybe LanguageCode
$sel:customLanguageCode:CaptionSelector' :: CaptionSelector -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"customLanguageCode" 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
customLanguageCode,
            (Key
"languageCode" 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 LanguageCode
languageCode,
            (Key
"sourceSettings" 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 CaptionSourceSettings
sourceSettings
          ]
      )