{-# 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.TeletextDestinationSettings
-- 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.TeletextDestinationSettings where

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

-- | Settings related to teletext captions. Set up teletext captions in the
-- same output as your video. For more information, see
-- https:\/\/docs.aws.amazon.com\/mediaconvert\/latest\/ug\/teletext-output-captions.html.
-- When you work directly in your JSON job specification, include this
-- object and any required children when you set destinationType to
-- TELETEXT.
--
-- /See:/ 'newTeletextDestinationSettings' smart constructor.
data TeletextDestinationSettings = TeletextDestinationSettings'
  { -- | Specify the page types for this Teletext page. If you don\'t specify a
    -- value here, the service sets the page type to the default value Subtitle
    -- (PAGE_TYPE_SUBTITLE). If you pass through the entire set of Teletext
    -- data, don\'t use this field. When you pass through a set of Teletext
    -- pages, your output has the same page types as your input.
    TeletextDestinationSettings -> Maybe [TeletextPageType]
pageTypes :: Prelude.Maybe [TeletextPageType],
    -- | Set pageNumber to the Teletext page number for the destination captions
    -- for this output. This value must be a three-digit hexadecimal string;
    -- strings ending in -FF are invalid. If you are passing through the entire
    -- set of Teletext data, do not use this field.
    TeletextDestinationSettings -> Maybe Text
pageNumber :: Prelude.Maybe Prelude.Text
  }
  deriving (TeletextDestinationSettings -> TeletextDestinationSettings -> Bool
(TeletextDestinationSettings
 -> TeletextDestinationSettings -> Bool)
-> (TeletextDestinationSettings
    -> TeletextDestinationSettings -> Bool)
-> Eq TeletextDestinationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TeletextDestinationSettings -> TeletextDestinationSettings -> Bool
$c/= :: TeletextDestinationSettings -> TeletextDestinationSettings -> Bool
== :: TeletextDestinationSettings -> TeletextDestinationSettings -> Bool
$c== :: TeletextDestinationSettings -> TeletextDestinationSettings -> Bool
Prelude.Eq, ReadPrec [TeletextDestinationSettings]
ReadPrec TeletextDestinationSettings
Int -> ReadS TeletextDestinationSettings
ReadS [TeletextDestinationSettings]
(Int -> ReadS TeletextDestinationSettings)
-> ReadS [TeletextDestinationSettings]
-> ReadPrec TeletextDestinationSettings
-> ReadPrec [TeletextDestinationSettings]
-> Read TeletextDestinationSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TeletextDestinationSettings]
$creadListPrec :: ReadPrec [TeletextDestinationSettings]
readPrec :: ReadPrec TeletextDestinationSettings
$creadPrec :: ReadPrec TeletextDestinationSettings
readList :: ReadS [TeletextDestinationSettings]
$creadList :: ReadS [TeletextDestinationSettings]
readsPrec :: Int -> ReadS TeletextDestinationSettings
$creadsPrec :: Int -> ReadS TeletextDestinationSettings
Prelude.Read, Int -> TeletextDestinationSettings -> ShowS
[TeletextDestinationSettings] -> ShowS
TeletextDestinationSettings -> String
(Int -> TeletextDestinationSettings -> ShowS)
-> (TeletextDestinationSettings -> String)
-> ([TeletextDestinationSettings] -> ShowS)
-> Show TeletextDestinationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TeletextDestinationSettings] -> ShowS
$cshowList :: [TeletextDestinationSettings] -> ShowS
show :: TeletextDestinationSettings -> String
$cshow :: TeletextDestinationSettings -> String
showsPrec :: Int -> TeletextDestinationSettings -> ShowS
$cshowsPrec :: Int -> TeletextDestinationSettings -> ShowS
Prelude.Show, (forall x.
 TeletextDestinationSettings -> Rep TeletextDestinationSettings x)
-> (forall x.
    Rep TeletextDestinationSettings x -> TeletextDestinationSettings)
-> Generic TeletextDestinationSettings
forall x.
Rep TeletextDestinationSettings x -> TeletextDestinationSettings
forall x.
TeletextDestinationSettings -> Rep TeletextDestinationSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TeletextDestinationSettings x -> TeletextDestinationSettings
$cfrom :: forall x.
TeletextDestinationSettings -> Rep TeletextDestinationSettings x
Prelude.Generic)

-- |
-- Create a value of 'TeletextDestinationSettings' 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:
--
-- 'pageTypes', 'teletextDestinationSettings_pageTypes' - Specify the page types for this Teletext page. If you don\'t specify a
-- value here, the service sets the page type to the default value Subtitle
-- (PAGE_TYPE_SUBTITLE). If you pass through the entire set of Teletext
-- data, don\'t use this field. When you pass through a set of Teletext
-- pages, your output has the same page types as your input.
--
-- 'pageNumber', 'teletextDestinationSettings_pageNumber' - Set pageNumber to the Teletext page number for the destination captions
-- for this output. This value must be a three-digit hexadecimal string;
-- strings ending in -FF are invalid. If you are passing through the entire
-- set of Teletext data, do not use this field.
newTeletextDestinationSettings ::
  TeletextDestinationSettings
newTeletextDestinationSettings :: TeletextDestinationSettings
newTeletextDestinationSettings =
  TeletextDestinationSettings' :: Maybe [TeletextPageType]
-> Maybe Text -> TeletextDestinationSettings
TeletextDestinationSettings'
    { $sel:pageTypes:TeletextDestinationSettings' :: Maybe [TeletextPageType]
pageTypes =
        Maybe [TeletextPageType]
forall a. Maybe a
Prelude.Nothing,
      $sel:pageNumber:TeletextDestinationSettings' :: Maybe Text
pageNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Specify the page types for this Teletext page. If you don\'t specify a
-- value here, the service sets the page type to the default value Subtitle
-- (PAGE_TYPE_SUBTITLE). If you pass through the entire set of Teletext
-- data, don\'t use this field. When you pass through a set of Teletext
-- pages, your output has the same page types as your input.
teletextDestinationSettings_pageTypes :: Lens.Lens' TeletextDestinationSettings (Prelude.Maybe [TeletextPageType])
teletextDestinationSettings_pageTypes :: (Maybe [TeletextPageType] -> f (Maybe [TeletextPageType]))
-> TeletextDestinationSettings -> f TeletextDestinationSettings
teletextDestinationSettings_pageTypes = (TeletextDestinationSettings -> Maybe [TeletextPageType])
-> (TeletextDestinationSettings
    -> Maybe [TeletextPageType] -> TeletextDestinationSettings)
-> Lens
     TeletextDestinationSettings
     TeletextDestinationSettings
     (Maybe [TeletextPageType])
     (Maybe [TeletextPageType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TeletextDestinationSettings' {Maybe [TeletextPageType]
pageTypes :: Maybe [TeletextPageType]
$sel:pageTypes:TeletextDestinationSettings' :: TeletextDestinationSettings -> Maybe [TeletextPageType]
pageTypes} -> Maybe [TeletextPageType]
pageTypes) (\s :: TeletextDestinationSettings
s@TeletextDestinationSettings' {} Maybe [TeletextPageType]
a -> TeletextDestinationSettings
s {$sel:pageTypes:TeletextDestinationSettings' :: Maybe [TeletextPageType]
pageTypes = Maybe [TeletextPageType]
a} :: TeletextDestinationSettings) ((Maybe [TeletextPageType] -> f (Maybe [TeletextPageType]))
 -> TeletextDestinationSettings -> f TeletextDestinationSettings)
-> ((Maybe [TeletextPageType] -> f (Maybe [TeletextPageType]))
    -> Maybe [TeletextPageType] -> f (Maybe [TeletextPageType]))
-> (Maybe [TeletextPageType] -> f (Maybe [TeletextPageType]))
-> TeletextDestinationSettings
-> f TeletextDestinationSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [TeletextPageType]
  [TeletextPageType]
  [TeletextPageType]
  [TeletextPageType]
-> Iso
     (Maybe [TeletextPageType])
     (Maybe [TeletextPageType])
     (Maybe [TeletextPageType])
     (Maybe [TeletextPageType])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [TeletextPageType]
  [TeletextPageType]
  [TeletextPageType]
  [TeletextPageType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Set pageNumber to the Teletext page number for the destination captions
-- for this output. This value must be a three-digit hexadecimal string;
-- strings ending in -FF are invalid. If you are passing through the entire
-- set of Teletext data, do not use this field.
teletextDestinationSettings_pageNumber :: Lens.Lens' TeletextDestinationSettings (Prelude.Maybe Prelude.Text)
teletextDestinationSettings_pageNumber :: (Maybe Text -> f (Maybe Text))
-> TeletextDestinationSettings -> f TeletextDestinationSettings
teletextDestinationSettings_pageNumber = (TeletextDestinationSettings -> Maybe Text)
-> (TeletextDestinationSettings
    -> Maybe Text -> TeletextDestinationSettings)
-> Lens
     TeletextDestinationSettings
     TeletextDestinationSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TeletextDestinationSettings' {Maybe Text
pageNumber :: Maybe Text
$sel:pageNumber:TeletextDestinationSettings' :: TeletextDestinationSettings -> Maybe Text
pageNumber} -> Maybe Text
pageNumber) (\s :: TeletextDestinationSettings
s@TeletextDestinationSettings' {} Maybe Text
a -> TeletextDestinationSettings
s {$sel:pageNumber:TeletextDestinationSettings' :: Maybe Text
pageNumber = Maybe Text
a} :: TeletextDestinationSettings)

instance Core.FromJSON TeletextDestinationSettings where
  parseJSON :: Value -> Parser TeletextDestinationSettings
parseJSON =
    String
-> (Object -> Parser TeletextDestinationSettings)
-> Value
-> Parser TeletextDestinationSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TeletextDestinationSettings"
      ( \Object
x ->
          Maybe [TeletextPageType]
-> Maybe Text -> TeletextDestinationSettings
TeletextDestinationSettings'
            (Maybe [TeletextPageType]
 -> Maybe Text -> TeletextDestinationSettings)
-> Parser (Maybe [TeletextPageType])
-> Parser (Maybe Text -> TeletextDestinationSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [TeletextPageType]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"pageTypes" Parser (Maybe (Maybe [TeletextPageType]))
-> Maybe [TeletextPageType] -> Parser (Maybe [TeletextPageType])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [TeletextPageType]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> TeletextDestinationSettings)
-> Parser (Maybe Text) -> Parser TeletextDestinationSettings
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
"pageNumber")
      )

instance Prelude.Hashable TeletextDestinationSettings

instance Prelude.NFData TeletextDestinationSettings

instance Core.ToJSON TeletextDestinationSettings where
  toJSON :: TeletextDestinationSettings -> Value
toJSON TeletextDestinationSettings' {Maybe [TeletextPageType]
Maybe Text
pageNumber :: Maybe Text
pageTypes :: Maybe [TeletextPageType]
$sel:pageNumber:TeletextDestinationSettings' :: TeletextDestinationSettings -> Maybe Text
$sel:pageTypes:TeletextDestinationSettings' :: TeletextDestinationSettings -> Maybe [TeletextPageType]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"pageTypes" Text -> [TeletextPageType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([TeletextPageType] -> Pair)
-> Maybe [TeletextPageType] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TeletextPageType]
pageTypes,
            (Text
"pageNumber" 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
pageNumber
          ]
      )