{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaConvert.Types.HlsCaptionLanguageMapping where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.LanguageCode
import qualified Amazonka.Prelude as Prelude

-- | Caption Language Mapping
--
-- /See:/ 'newHlsCaptionLanguageMapping' smart constructor.
data HlsCaptionLanguageMapping = HlsCaptionLanguageMapping'
  { -- | 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,
    -- | Caption channel.
    HlsCaptionLanguageMapping -> Maybe Int
captionChannel :: Prelude.Maybe Prelude.Int
  }
  deriving (HlsCaptionLanguageMapping -> HlsCaptionLanguageMapping -> Bool
(HlsCaptionLanguageMapping -> HlsCaptionLanguageMapping -> Bool)
-> (HlsCaptionLanguageMapping -> HlsCaptionLanguageMapping -> Bool)
-> Eq HlsCaptionLanguageMapping
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]
(Int -> ReadS HlsCaptionLanguageMapping)
-> ReadS [HlsCaptionLanguageMapping]
-> ReadPrec HlsCaptionLanguageMapping
-> ReadPrec [HlsCaptionLanguageMapping]
-> Read 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
(Int -> HlsCaptionLanguageMapping -> ShowS)
-> (HlsCaptionLanguageMapping -> String)
-> ([HlsCaptionLanguageMapping] -> ShowS)
-> Show HlsCaptionLanguageMapping
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.
 HlsCaptionLanguageMapping -> Rep HlsCaptionLanguageMapping x)
-> (forall x.
    Rep HlsCaptionLanguageMapping x -> HlsCaptionLanguageMapping)
-> Generic HlsCaptionLanguageMapping
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:
--
-- '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.
--
-- 'captionChannel', 'hlsCaptionLanguageMapping_captionChannel' - Caption channel.
newHlsCaptionLanguageMapping ::
  HlsCaptionLanguageMapping
newHlsCaptionLanguageMapping :: HlsCaptionLanguageMapping
newHlsCaptionLanguageMapping =
  HlsCaptionLanguageMapping' :: Maybe Text
-> Maybe LanguageCode
-> Maybe Text
-> Maybe Int
-> HlsCaptionLanguageMapping
HlsCaptionLanguageMapping'
    { $sel:customLanguageCode:HlsCaptionLanguageMapping' :: Maybe Text
customLanguageCode =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:HlsCaptionLanguageMapping' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
forall a. Maybe a
Prelude.Nothing,
      $sel:languageDescription:HlsCaptionLanguageMapping' :: Maybe Text
languageDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:captionChannel:HlsCaptionLanguageMapping' :: Maybe Int
captionChannel = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> HlsCaptionLanguageMapping -> f HlsCaptionLanguageMapping
hlsCaptionLanguageMapping_customLanguageCode = (HlsCaptionLanguageMapping -> Maybe Text)
-> (HlsCaptionLanguageMapping
    -> Maybe Text -> HlsCaptionLanguageMapping)
-> Lens
     HlsCaptionLanguageMapping
     HlsCaptionLanguageMapping
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe LanguageCode -> f (Maybe LanguageCode))
-> HlsCaptionLanguageMapping -> f HlsCaptionLanguageMapping
hlsCaptionLanguageMapping_languageCode = (HlsCaptionLanguageMapping -> Maybe LanguageCode)
-> (HlsCaptionLanguageMapping
    -> Maybe LanguageCode -> HlsCaptionLanguageMapping)
-> Lens
     HlsCaptionLanguageMapping
     HlsCaptionLanguageMapping
     (Maybe LanguageCode)
     (Maybe 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 :: (Maybe Text -> f (Maybe Text))
-> HlsCaptionLanguageMapping -> f HlsCaptionLanguageMapping
hlsCaptionLanguageMapping_languageDescription = (HlsCaptionLanguageMapping -> Maybe Text)
-> (HlsCaptionLanguageMapping
    -> Maybe Text -> HlsCaptionLanguageMapping)
-> Lens
     HlsCaptionLanguageMapping
     HlsCaptionLanguageMapping
     (Maybe Text)
     (Maybe Text)
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)

-- | Caption channel.
hlsCaptionLanguageMapping_captionChannel :: Lens.Lens' HlsCaptionLanguageMapping (Prelude.Maybe Prelude.Int)
hlsCaptionLanguageMapping_captionChannel :: (Maybe Int -> f (Maybe Int))
-> HlsCaptionLanguageMapping -> f HlsCaptionLanguageMapping
hlsCaptionLanguageMapping_captionChannel = (HlsCaptionLanguageMapping -> Maybe Int)
-> (HlsCaptionLanguageMapping
    -> Maybe Int -> HlsCaptionLanguageMapping)
-> Lens
     HlsCaptionLanguageMapping
     HlsCaptionLanguageMapping
     (Maybe Int)
     (Maybe Int)
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)

instance Core.FromJSON HlsCaptionLanguageMapping where
  parseJSON :: Value -> Parser HlsCaptionLanguageMapping
parseJSON =
    String
-> (Object -> Parser HlsCaptionLanguageMapping)
-> Value
-> Parser HlsCaptionLanguageMapping
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HlsCaptionLanguageMapping"
      ( \Object
x ->
          Maybe Text
-> Maybe LanguageCode
-> Maybe Text
-> Maybe Int
-> HlsCaptionLanguageMapping
HlsCaptionLanguageMapping'
            (Maybe Text
 -> Maybe LanguageCode
 -> Maybe Text
 -> Maybe Int
 -> HlsCaptionLanguageMapping)
-> Parser (Maybe Text)
-> Parser
     (Maybe LanguageCode
      -> Maybe Text -> Maybe Int -> HlsCaptionLanguageMapping)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"customLanguageCode")
            Parser
  (Maybe LanguageCode
   -> Maybe Text -> Maybe Int -> HlsCaptionLanguageMapping)
-> Parser (Maybe LanguageCode)
-> Parser (Maybe Text -> Maybe Int -> HlsCaptionLanguageMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LanguageCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"languageCode")
            Parser (Maybe Text -> Maybe Int -> HlsCaptionLanguageMapping)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> HlsCaptionLanguageMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"languageDescription")
            Parser (Maybe Int -> HlsCaptionLanguageMapping)
-> Parser (Maybe Int) -> Parser HlsCaptionLanguageMapping
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"captionChannel")
      )

instance Prelude.Hashable HlsCaptionLanguageMapping

instance Prelude.NFData HlsCaptionLanguageMapping

instance Core.ToJSON HlsCaptionLanguageMapping where
  toJSON :: HlsCaptionLanguageMapping -> Value
toJSON HlsCaptionLanguageMapping' {Maybe Int
Maybe Text
Maybe LanguageCode
captionChannel :: Maybe Int
languageDescription :: Maybe Text
languageCode :: Maybe LanguageCode
customLanguageCode :: Maybe Text
$sel:captionChannel:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Int
$sel:languageDescription:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Text
$sel:languageCode:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe LanguageCode
$sel:customLanguageCode:HlsCaptionLanguageMapping' :: HlsCaptionLanguageMapping -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"customLanguageCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
customLanguageCode,
            (Text
"languageCode" Text -> LanguageCode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LanguageCode -> Pair) -> Maybe LanguageCode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LanguageCode
languageCode,
            (Text
"languageDescription" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
languageDescription,
            (Text
"captionChannel" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
captionChannel
          ]
      )