{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.Scte27SourceSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:ocrLanguage:Scte27SourceSettings' :: Maybe Scte27OcrLanguage
ocrLanguage =
        forall a. Maybe a
Prelude.Nothing,
      $sel:pid:Scte27SourceSettings' :: Maybe Natural
pid = 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 :: Lens' Scte27SourceSettings (Maybe Scte27OcrLanguage)
scte27SourceSettings_ocrLanguage = 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 :: Lens' Scte27SourceSettings (Maybe Natural)
scte27SourceSettings_pid = 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 Data.FromJSON Scte27SourceSettings where
  parseJSON :: Value -> Parser Scte27SourceSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Scte27SourceSettings"
      ( \Object
x ->
          Maybe Scte27OcrLanguage -> Maybe Natural -> Scte27SourceSettings
Scte27SourceSettings'
            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
"ocrLanguage")
            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
"pid")
      )

instance Prelude.Hashable Scte27SourceSettings where
  hashWithSalt :: Int -> Scte27SourceSettings -> Int
hashWithSalt Int
_salt Scte27SourceSettings' {Maybe Natural
Maybe Scte27OcrLanguage
pid :: Maybe Natural
ocrLanguage :: Maybe Scte27OcrLanguage
$sel:pid:Scte27SourceSettings' :: Scte27SourceSettings -> Maybe Natural
$sel:ocrLanguage:Scte27SourceSettings' :: Scte27SourceSettings -> Maybe Scte27OcrLanguage
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Scte27OcrLanguage
ocrLanguage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
pid

instance Prelude.NFData Scte27SourceSettings where
  rnf :: Scte27SourceSettings -> ()
rnf Scte27SourceSettings' {Maybe Natural
Maybe Scte27OcrLanguage
pid :: Maybe Natural
ocrLanguage :: Maybe Scte27OcrLanguage
$sel:pid:Scte27SourceSettings' :: Scte27SourceSettings -> Maybe Natural
$sel:ocrLanguage:Scte27SourceSettings' :: Scte27SourceSettings -> Maybe Scte27OcrLanguage
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Scte27OcrLanguage
ocrLanguage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
pid

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ocrLanguage" 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 Scte27OcrLanguage
ocrLanguage,
            (Key
"pid" 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 Natural
pid
          ]
      )