{-# 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.MediaLive.Types.Scte27SourceSettings
-- 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.MediaLive.Types.Scte27SourceSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.Scte27OcrLanguage
import qualified Amazonka.Prelude as Prelude

-- | Scte27 Source Settings
--
-- /See:/ 'newScte27SourceSettings' smart constructor.
data Scte27SourceSettings = Scte27SourceSettings'
  { -- | If you will configure a WebVTT caption description that references this
    -- caption selector, use this field to provide the language to consider
    -- when translating the image-based source to text.
    Scte27SourceSettings -> Maybe Scte27OcrLanguage
ocrLanguage :: Prelude.Maybe Scte27OcrLanguage,
    -- | The pid field is used in conjunction with the caption selector
    -- languageCode field as follows: - Specify PID and Language: Extracts
    -- captions from that PID; the language is \"informational\". - Specify PID
    -- and omit Language: Extracts the specified PID. - Omit PID and specify
    -- Language: Extracts the specified language, whichever PID that happens to
    -- be. - Omit PID and omit Language: Valid only if source is DVB-Sub that
    -- is being passed through; all languages will be passed through.
    Scte27SourceSettings -> Maybe Natural
pid :: Prelude.Maybe Prelude.Natural
  }
  deriving (Scte27SourceSettings -> Scte27SourceSettings -> Bool
(Scte27SourceSettings -> Scte27SourceSettings -> Bool)
-> (Scte27SourceSettings -> Scte27SourceSettings -> Bool)
-> Eq Scte27SourceSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scte27SourceSettings -> Scte27SourceSettings -> Bool
$c/= :: Scte27SourceSettings -> Scte27SourceSettings -> Bool
== :: Scte27SourceSettings -> Scte27SourceSettings -> Bool
$c== :: Scte27SourceSettings -> Scte27SourceSettings -> Bool
Prelude.Eq, ReadPrec [Scte27SourceSettings]
ReadPrec Scte27SourceSettings
Int -> ReadS Scte27SourceSettings
ReadS [Scte27SourceSettings]
(Int -> ReadS Scte27SourceSettings)
-> ReadS [Scte27SourceSettings]
-> ReadPrec Scte27SourceSettings
-> ReadPrec [Scte27SourceSettings]
-> Read Scte27SourceSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Scte27SourceSettings]
$creadListPrec :: ReadPrec [Scte27SourceSettings]
readPrec :: ReadPrec Scte27SourceSettings
$creadPrec :: ReadPrec Scte27SourceSettings
readList :: ReadS [Scte27SourceSettings]
$creadList :: ReadS [Scte27SourceSettings]
readsPrec :: Int -> ReadS Scte27SourceSettings
$creadsPrec :: Int -> ReadS Scte27SourceSettings
Prelude.Read, Int -> Scte27SourceSettings -> ShowS
[Scte27SourceSettings] -> ShowS
Scte27SourceSettings -> String
(Int -> Scte27SourceSettings -> ShowS)
-> (Scte27SourceSettings -> String)
-> ([Scte27SourceSettings] -> ShowS)
-> Show Scte27SourceSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scte27SourceSettings] -> ShowS
$cshowList :: [Scte27SourceSettings] -> ShowS
show :: Scte27SourceSettings -> String
$cshow :: Scte27SourceSettings -> String
showsPrec :: Int -> Scte27SourceSettings -> ShowS
$cshowsPrec :: Int -> Scte27SourceSettings -> ShowS
Prelude.Show, (forall x. Scte27SourceSettings -> Rep Scte27SourceSettings x)
-> (forall x. Rep Scte27SourceSettings x -> Scte27SourceSettings)
-> Generic Scte27SourceSettings
forall x. Rep Scte27SourceSettings x -> Scte27SourceSettings
forall x. Scte27SourceSettings -> Rep Scte27SourceSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Scte27SourceSettings x -> Scte27SourceSettings
$cfrom :: forall x. Scte27SourceSettings -> Rep Scte27SourceSettings x
Prelude.Generic)

-- |
-- Create a value of 'Scte27SourceSettings' 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:
--
-- 'ocrLanguage', 'scte27SourceSettings_ocrLanguage' - If you will configure a WebVTT caption description that references this
-- caption selector, use this field to provide the language to consider
-- when translating the image-based source to text.
--
-- 'pid', 'scte27SourceSettings_pid' - The pid field is used in conjunction with the caption selector
-- languageCode field as follows: - Specify PID and Language: Extracts
-- captions from that PID; the language is \"informational\". - Specify PID
-- and omit Language: Extracts the specified PID. - Omit PID and specify
-- Language: Extracts the specified language, whichever PID that happens to
-- be. - Omit PID and omit Language: Valid only if source is DVB-Sub that
-- is being passed through; all languages will be passed through.
newScte27SourceSettings ::
  Scte27SourceSettings
newScte27SourceSettings :: Scte27SourceSettings
newScte27SourceSettings =
  Scte27SourceSettings' :: Maybe Scte27OcrLanguage -> Maybe Natural -> Scte27SourceSettings
Scte27SourceSettings'
    { $sel:ocrLanguage:Scte27SourceSettings' :: Maybe Scte27OcrLanguage
ocrLanguage =
        Maybe Scte27OcrLanguage
forall a. Maybe a
Prelude.Nothing,
      $sel:pid:Scte27SourceSettings' :: Maybe Natural
pid = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | If you will configure a WebVTT caption description that references this
-- caption selector, use this field to provide the language to consider
-- when translating the image-based source to text.
scte27SourceSettings_ocrLanguage :: Lens.Lens' Scte27SourceSettings (Prelude.Maybe Scte27OcrLanguage)
scte27SourceSettings_ocrLanguage :: (Maybe Scte27OcrLanguage -> f (Maybe Scte27OcrLanguage))
-> Scte27SourceSettings -> f Scte27SourceSettings
scte27SourceSettings_ocrLanguage = (Scte27SourceSettings -> Maybe Scte27OcrLanguage)
-> (Scte27SourceSettings
    -> Maybe Scte27OcrLanguage -> Scte27SourceSettings)
-> Lens
     Scte27SourceSettings
     Scte27SourceSettings
     (Maybe Scte27OcrLanguage)
     (Maybe Scte27OcrLanguage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte27SourceSettings' {Maybe Scte27OcrLanguage
ocrLanguage :: Maybe Scte27OcrLanguage
$sel:ocrLanguage:Scte27SourceSettings' :: Scte27SourceSettings -> Maybe Scte27OcrLanguage
ocrLanguage} -> Maybe Scte27OcrLanguage
ocrLanguage) (\s :: Scte27SourceSettings
s@Scte27SourceSettings' {} Maybe Scte27OcrLanguage
a -> Scte27SourceSettings
s {$sel:ocrLanguage:Scte27SourceSettings' :: Maybe Scte27OcrLanguage
ocrLanguage = Maybe Scte27OcrLanguage
a} :: Scte27SourceSettings)

-- | The pid field is used in conjunction with the caption selector
-- languageCode field as follows: - Specify PID and Language: Extracts
-- captions from that PID; the language is \"informational\". - Specify PID
-- and omit Language: Extracts the specified PID. - Omit PID and specify
-- Language: Extracts the specified language, whichever PID that happens to
-- be. - Omit PID and omit Language: Valid only if source is DVB-Sub that
-- is being passed through; all languages will be passed through.
scte27SourceSettings_pid :: Lens.Lens' Scte27SourceSettings (Prelude.Maybe Prelude.Natural)
scte27SourceSettings_pid :: (Maybe Natural -> f (Maybe Natural))
-> Scte27SourceSettings -> f Scte27SourceSettings
scte27SourceSettings_pid = (Scte27SourceSettings -> Maybe Natural)
-> (Scte27SourceSettings -> Maybe Natural -> Scte27SourceSettings)
-> Lens
     Scte27SourceSettings
     Scte27SourceSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte27SourceSettings' {Maybe Natural
pid :: Maybe Natural
$sel:pid:Scte27SourceSettings' :: Scte27SourceSettings -> Maybe Natural
pid} -> Maybe Natural
pid) (\s :: Scte27SourceSettings
s@Scte27SourceSettings' {} Maybe Natural
a -> Scte27SourceSettings
s {$sel:pid:Scte27SourceSettings' :: Maybe Natural
pid = Maybe Natural
a} :: Scte27SourceSettings)

instance Core.FromJSON Scte27SourceSettings where
  parseJSON :: Value -> Parser Scte27SourceSettings
parseJSON =
    String
-> (Object -> Parser Scte27SourceSettings)
-> Value
-> Parser Scte27SourceSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Scte27SourceSettings"
      ( \Object
x ->
          Maybe Scte27OcrLanguage -> Maybe Natural -> Scte27SourceSettings
Scte27SourceSettings'
            (Maybe Scte27OcrLanguage -> Maybe Natural -> Scte27SourceSettings)
-> Parser (Maybe Scte27OcrLanguage)
-> Parser (Maybe Natural -> Scte27SourceSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Scte27OcrLanguage)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ocrLanguage")
            Parser (Maybe Natural -> Scte27SourceSettings)
-> Parser (Maybe Natural) -> Parser Scte27SourceSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"pid")
      )

instance Prelude.Hashable Scte27SourceSettings

instance Prelude.NFData Scte27SourceSettings

instance Core.ToJSON Scte27SourceSettings where
  toJSON :: Scte27SourceSettings -> Value
toJSON Scte27SourceSettings' {Maybe Natural
Maybe Scte27OcrLanguage
pid :: Maybe Natural
ocrLanguage :: Maybe Scte27OcrLanguage
$sel:pid:Scte27SourceSettings' :: Scte27SourceSettings -> Maybe Natural
$sel:ocrLanguage:Scte27SourceSettings' :: Scte27SourceSettings -> Maybe Scte27OcrLanguage
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ocrLanguage" Text -> Scte27OcrLanguage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Scte27OcrLanguage -> Pair)
-> Maybe Scte27OcrLanguage -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Scte27OcrLanguage
ocrLanguage,
            (Text
"pid" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
pid
          ]
      )