{-# 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.HlsCaptionLanguageMapping
-- 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.HlsCaptionLanguageMapping 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.LanguageCode
import qualified Amazonka.Prelude as Prelude

-- | Caption Language Mapping
--
-- /See:/ 'newHlsCaptionLanguageMapping' smart constructor.
data HlsCaptionLanguageMapping = HlsCaptionLanguageMapping'
  { -- | Caption channel.
    HlsCaptionLanguageMapping -> Maybe Int
captionChannel :: Prelude.Maybe Prelude.Int,
    -- | Specify the language for this captions channel, using the ISO 639-2 or
    -- ISO 639-3 three-letter language code
    HlsCaptionLanguageMapping -> Maybe Text
customLanguageCode :: Prelude.Maybe Prelude.Text,
    -- | Specify the language, using the ISO 639-2 three-letter code listed at
    -- https:\/\/www.loc.gov\/standards\/iso639-2\/php\/code_list.php.
    HlsCaptionLanguageMapping -> Maybe LanguageCode
languageCode :: Prelude.Maybe LanguageCode,
    -- | Caption language description.
    HlsCaptionLanguageMapping -> Maybe Text
languageDescription :: Prelude.Maybe Prelude.Text
  }
  deriving (HlsCaptionLanguageMapping -> HlsCaptionLanguageMapping -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HlsCaptionLanguageMapping -> HlsCaptionLanguageMapping -> Bool
$c/= :: HlsCaptionLanguageMapping -> HlsCaptionLanguageMapping -> Bool
== :: HlsCaptionLanguageMapping -> HlsCaptionLanguageMapping -> Bool
$c== :: HlsCaptionLanguageMapping -> HlsCaptionLanguageMapping -> Bool
Prelude.Eq, ReadPrec [HlsCaptionLanguageMapping]
ReadPrec HlsCaptionLanguageMapping
Int -> ReadS HlsCaptionLanguageMapping
ReadS [HlsCaptionLanguageMapping]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HlsCaptionLanguageMapping]
$creadListPrec :: ReadPrec [HlsCaptionLanguageMapping]
readPrec :: ReadPrec HlsCaptionLanguageMapping
$creadPrec :: ReadPrec HlsCaptionLanguageMapping
readList :: ReadS [HlsCaptionLanguageMapping]
$creadList :: ReadS [HlsCaptionLanguageMapping]
readsPrec :: Int -> ReadS HlsCaptionLanguageMapping
$creadsPrec :: Int -> ReadS HlsCaptionLanguageMapping
Prelude.Read, Int -> HlsCaptionLanguageMapping -> ShowS
[HlsCaptionLanguageMapping] -> ShowS
HlsCaptionLanguageMapping -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HlsCaptionLanguageMapping] -> ShowS
$cshowList :: [HlsCaptionLanguageMapping] -> ShowS
show :: HlsCaptionLanguageMapping -> String
$cshow :: HlsCaptionLanguageMapping -> String
showsPrec :: Int -> HlsCaptionLanguageMapping -> ShowS
$cshowsPrec :: Int -> HlsCaptionLanguageMapping -> ShowS
Prelude.Show, forall x.
Rep HlsCaptionLanguageMapping x -> HlsCaptionLanguageMapping
forall x.
HlsCaptionLanguageMapping -> Rep HlsCaptionLanguageMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HlsCaptionLanguageMapping x -> HlsCaptionLanguageMapping
$cfrom :: forall x.
HlsCaptionLanguageMapping -> Rep HlsCaptionLanguageMapping x
Prelude.Generic)

-- |
-- Create a value of 'HlsCaptionLanguageMapping' 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:
--
-- 'captionChannel', 'hlsCaptionLanguageMapping_captionChannel' - Caption channel.
--
-- 'customLanguageCode', 'hlsCaptionLanguageMapping_customLanguageCode' - Specify the language for this captions channel, using the ISO 639-2 or
-- ISO 639-3 three-letter language code
--
-- 'languageCode', 'hlsCaptionLanguageMapping_languageCode' - Specify the language, using the ISO 639-2 three-letter code listed at
-- https:\/\/www.loc.gov\/standards\/iso639-2\/php\/code_list.php.
--
-- 'languageDescription', 'hlsCaptionLanguageMapping_languageDescription' - Caption language description.
newHlsCaptionLanguageMapping ::
  HlsCaptionLanguageMapping
newHlsCaptionLanguageMapping :: HlsCaptionLanguageMapping
newHlsCaptionLanguageMapping =
  HlsCaptionLanguageMapping'
    { $sel:captionChannel:HlsCaptionLanguageMapping' :: Maybe Int
captionChannel =
        forall a. Maybe a
Prelude.Nothing,
      $sel:customLanguageCode:HlsCaptionLanguageMapping' :: Maybe Text
customLanguageCode = forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:HlsCaptionLanguageMapping' :: Maybe LanguageCode
languageCode = forall a. Maybe a
Prelude.Nothing,
      $sel:languageDescription:HlsCaptionLanguageMapping' :: Maybe Text
languageDescription = forall a. Maybe a
Prelude.Nothing
    }

-- | Caption channel.
hlsCaptionLanguageMapping_captionChannel :: Lens.Lens' HlsCaptionLanguageMapping (Prelude.Maybe Prelude.Int)
hlsCaptionLanguageMapping_captionChannel :: Lens' HlsCaptionLanguageMapping (Maybe Int)
hlsCaptionLanguageMapping_captionChannel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsCaptionLanguageMapping' {Maybe Int
captionChannel :: Maybe Int
$sel:captionChannel:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Int
captionChannel} -> Maybe Int
captionChannel) (\s :: HlsCaptionLanguageMapping
s@HlsCaptionLanguageMapping' {} Maybe Int
a -> HlsCaptionLanguageMapping
s {$sel:captionChannel:HlsCaptionLanguageMapping' :: Maybe Int
captionChannel = Maybe Int
a} :: HlsCaptionLanguageMapping)

-- | Specify the language for this captions channel, using the ISO 639-2 or
-- ISO 639-3 three-letter language code
hlsCaptionLanguageMapping_customLanguageCode :: Lens.Lens' HlsCaptionLanguageMapping (Prelude.Maybe Prelude.Text)
hlsCaptionLanguageMapping_customLanguageCode :: Lens' HlsCaptionLanguageMapping (Maybe Text)
hlsCaptionLanguageMapping_customLanguageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsCaptionLanguageMapping' {Maybe Text
customLanguageCode :: Maybe Text
$sel:customLanguageCode:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Text
customLanguageCode} -> Maybe Text
customLanguageCode) (\s :: HlsCaptionLanguageMapping
s@HlsCaptionLanguageMapping' {} Maybe Text
a -> HlsCaptionLanguageMapping
s {$sel:customLanguageCode:HlsCaptionLanguageMapping' :: Maybe Text
customLanguageCode = Maybe Text
a} :: HlsCaptionLanguageMapping)

-- | Specify the language, using the ISO 639-2 three-letter code listed at
-- https:\/\/www.loc.gov\/standards\/iso639-2\/php\/code_list.php.
hlsCaptionLanguageMapping_languageCode :: Lens.Lens' HlsCaptionLanguageMapping (Prelude.Maybe LanguageCode)
hlsCaptionLanguageMapping_languageCode :: Lens' HlsCaptionLanguageMapping (Maybe LanguageCode)
hlsCaptionLanguageMapping_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsCaptionLanguageMapping' {Maybe LanguageCode
languageCode :: Maybe LanguageCode
$sel:languageCode:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe LanguageCode
languageCode} -> Maybe LanguageCode
languageCode) (\s :: HlsCaptionLanguageMapping
s@HlsCaptionLanguageMapping' {} Maybe LanguageCode
a -> HlsCaptionLanguageMapping
s {$sel:languageCode:HlsCaptionLanguageMapping' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
a} :: HlsCaptionLanguageMapping)

-- | Caption language description.
hlsCaptionLanguageMapping_languageDescription :: Lens.Lens' HlsCaptionLanguageMapping (Prelude.Maybe Prelude.Text)
hlsCaptionLanguageMapping_languageDescription :: Lens' HlsCaptionLanguageMapping (Maybe Text)
hlsCaptionLanguageMapping_languageDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsCaptionLanguageMapping' {Maybe Text
languageDescription :: Maybe Text
$sel:languageDescription:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Text
languageDescription} -> Maybe Text
languageDescription) (\s :: HlsCaptionLanguageMapping
s@HlsCaptionLanguageMapping' {} Maybe Text
a -> HlsCaptionLanguageMapping
s {$sel:languageDescription:HlsCaptionLanguageMapping' :: Maybe Text
languageDescription = Maybe Text
a} :: HlsCaptionLanguageMapping)

instance Data.FromJSON HlsCaptionLanguageMapping where
  parseJSON :: Value -> Parser HlsCaptionLanguageMapping
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HlsCaptionLanguageMapping"
      ( \Object
x ->
          Maybe Int
-> Maybe Text
-> Maybe LanguageCode
-> Maybe Text
-> HlsCaptionLanguageMapping
HlsCaptionLanguageMapping'
            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
"captionChannel")
            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
"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
"languageDescription")
      )

instance Prelude.Hashable HlsCaptionLanguageMapping where
  hashWithSalt :: Int -> HlsCaptionLanguageMapping -> Int
hashWithSalt Int
_salt HlsCaptionLanguageMapping' {Maybe Int
Maybe Text
Maybe LanguageCode
languageDescription :: Maybe Text
languageCode :: Maybe LanguageCode
customLanguageCode :: Maybe Text
captionChannel :: Maybe Int
$sel:languageDescription:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Text
$sel:languageCode:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe LanguageCode
$sel:customLanguageCode:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Text
$sel:captionChannel:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
captionChannel
      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 Text
languageDescription

instance Prelude.NFData HlsCaptionLanguageMapping where
  rnf :: HlsCaptionLanguageMapping -> ()
rnf HlsCaptionLanguageMapping' {Maybe Int
Maybe Text
Maybe LanguageCode
languageDescription :: Maybe Text
languageCode :: Maybe LanguageCode
customLanguageCode :: Maybe Text
captionChannel :: Maybe Int
$sel:languageDescription:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Text
$sel:languageCode:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe LanguageCode
$sel:customLanguageCode:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Text
$sel:captionChannel:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
captionChannel
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
languageDescription

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