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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.CopyProtectionAction
import Amazonka.MediaConvert.Types.VchipAction
import qualified Amazonka.Prelude as Prelude

-- | If your source content has EIA-608 Line 21 Data Services, enable this
-- feature to specify what MediaConvert does with the Extended Data
-- Services (XDS) packets. You can choose to pass through XDS packets, or
-- remove them from the output. For more information about XDS, see EIA-608
-- Line Data Services, section 9.5.1.5 05h Content Advisory.
--
-- /See:/ 'newExtendedDataServices' smart constructor.
data ExtendedDataServices = ExtendedDataServices'
  { -- | The action to take on content advisory XDS packets. If you select
    -- PASSTHROUGH, packets will not be changed. If you select STRIP, any
    -- packets will be removed in output captions.
    ExtendedDataServices -> Maybe VchipAction
vchipAction :: Prelude.Maybe VchipAction,
    -- | The action to take on copy and redistribution control XDS packets. If
    -- you select PASSTHROUGH, packets will not be changed. If you select
    -- STRIP, any packets will be removed in output captions.
    ExtendedDataServices -> Maybe CopyProtectionAction
copyProtectionAction :: Prelude.Maybe CopyProtectionAction
  }
  deriving (ExtendedDataServices -> ExtendedDataServices -> Bool
(ExtendedDataServices -> ExtendedDataServices -> Bool)
-> (ExtendedDataServices -> ExtendedDataServices -> Bool)
-> Eq ExtendedDataServices
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExtendedDataServices -> ExtendedDataServices -> Bool
$c/= :: ExtendedDataServices -> ExtendedDataServices -> Bool
== :: ExtendedDataServices -> ExtendedDataServices -> Bool
$c== :: ExtendedDataServices -> ExtendedDataServices -> Bool
Prelude.Eq, ReadPrec [ExtendedDataServices]
ReadPrec ExtendedDataServices
Int -> ReadS ExtendedDataServices
ReadS [ExtendedDataServices]
(Int -> ReadS ExtendedDataServices)
-> ReadS [ExtendedDataServices]
-> ReadPrec ExtendedDataServices
-> ReadPrec [ExtendedDataServices]
-> Read ExtendedDataServices
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExtendedDataServices]
$creadListPrec :: ReadPrec [ExtendedDataServices]
readPrec :: ReadPrec ExtendedDataServices
$creadPrec :: ReadPrec ExtendedDataServices
readList :: ReadS [ExtendedDataServices]
$creadList :: ReadS [ExtendedDataServices]
readsPrec :: Int -> ReadS ExtendedDataServices
$creadsPrec :: Int -> ReadS ExtendedDataServices
Prelude.Read, Int -> ExtendedDataServices -> ShowS
[ExtendedDataServices] -> ShowS
ExtendedDataServices -> String
(Int -> ExtendedDataServices -> ShowS)
-> (ExtendedDataServices -> String)
-> ([ExtendedDataServices] -> ShowS)
-> Show ExtendedDataServices
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExtendedDataServices] -> ShowS
$cshowList :: [ExtendedDataServices] -> ShowS
show :: ExtendedDataServices -> String
$cshow :: ExtendedDataServices -> String
showsPrec :: Int -> ExtendedDataServices -> ShowS
$cshowsPrec :: Int -> ExtendedDataServices -> ShowS
Prelude.Show, (forall x. ExtendedDataServices -> Rep ExtendedDataServices x)
-> (forall x. Rep ExtendedDataServices x -> ExtendedDataServices)
-> Generic ExtendedDataServices
forall x. Rep ExtendedDataServices x -> ExtendedDataServices
forall x. ExtendedDataServices -> Rep ExtendedDataServices x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExtendedDataServices x -> ExtendedDataServices
$cfrom :: forall x. ExtendedDataServices -> Rep ExtendedDataServices x
Prelude.Generic)

-- |
-- Create a value of 'ExtendedDataServices' 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:
--
-- 'vchipAction', 'extendedDataServices_vchipAction' - The action to take on content advisory XDS packets. If you select
-- PASSTHROUGH, packets will not be changed. If you select STRIP, any
-- packets will be removed in output captions.
--
-- 'copyProtectionAction', 'extendedDataServices_copyProtectionAction' - The action to take on copy and redistribution control XDS packets. If
-- you select PASSTHROUGH, packets will not be changed. If you select
-- STRIP, any packets will be removed in output captions.
newExtendedDataServices ::
  ExtendedDataServices
newExtendedDataServices :: ExtendedDataServices
newExtendedDataServices =
  ExtendedDataServices' :: Maybe VchipAction
-> Maybe CopyProtectionAction -> ExtendedDataServices
ExtendedDataServices'
    { $sel:vchipAction:ExtendedDataServices' :: Maybe VchipAction
vchipAction =
        Maybe VchipAction
forall a. Maybe a
Prelude.Nothing,
      $sel:copyProtectionAction:ExtendedDataServices' :: Maybe CopyProtectionAction
copyProtectionAction = Maybe CopyProtectionAction
forall a. Maybe a
Prelude.Nothing
    }

-- | The action to take on content advisory XDS packets. If you select
-- PASSTHROUGH, packets will not be changed. If you select STRIP, any
-- packets will be removed in output captions.
extendedDataServices_vchipAction :: Lens.Lens' ExtendedDataServices (Prelude.Maybe VchipAction)
extendedDataServices_vchipAction :: (Maybe VchipAction -> f (Maybe VchipAction))
-> ExtendedDataServices -> f ExtendedDataServices
extendedDataServices_vchipAction = (ExtendedDataServices -> Maybe VchipAction)
-> (ExtendedDataServices
    -> Maybe VchipAction -> ExtendedDataServices)
-> Lens
     ExtendedDataServices
     ExtendedDataServices
     (Maybe VchipAction)
     (Maybe VchipAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExtendedDataServices' {Maybe VchipAction
vchipAction :: Maybe VchipAction
$sel:vchipAction:ExtendedDataServices' :: ExtendedDataServices -> Maybe VchipAction
vchipAction} -> Maybe VchipAction
vchipAction) (\s :: ExtendedDataServices
s@ExtendedDataServices' {} Maybe VchipAction
a -> ExtendedDataServices
s {$sel:vchipAction:ExtendedDataServices' :: Maybe VchipAction
vchipAction = Maybe VchipAction
a} :: ExtendedDataServices)

-- | The action to take on copy and redistribution control XDS packets. If
-- you select PASSTHROUGH, packets will not be changed. If you select
-- STRIP, any packets will be removed in output captions.
extendedDataServices_copyProtectionAction :: Lens.Lens' ExtendedDataServices (Prelude.Maybe CopyProtectionAction)
extendedDataServices_copyProtectionAction :: (Maybe CopyProtectionAction -> f (Maybe CopyProtectionAction))
-> ExtendedDataServices -> f ExtendedDataServices
extendedDataServices_copyProtectionAction = (ExtendedDataServices -> Maybe CopyProtectionAction)
-> (ExtendedDataServices
    -> Maybe CopyProtectionAction -> ExtendedDataServices)
-> Lens
     ExtendedDataServices
     ExtendedDataServices
     (Maybe CopyProtectionAction)
     (Maybe CopyProtectionAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExtendedDataServices' {Maybe CopyProtectionAction
copyProtectionAction :: Maybe CopyProtectionAction
$sel:copyProtectionAction:ExtendedDataServices' :: ExtendedDataServices -> Maybe CopyProtectionAction
copyProtectionAction} -> Maybe CopyProtectionAction
copyProtectionAction) (\s :: ExtendedDataServices
s@ExtendedDataServices' {} Maybe CopyProtectionAction
a -> ExtendedDataServices
s {$sel:copyProtectionAction:ExtendedDataServices' :: Maybe CopyProtectionAction
copyProtectionAction = Maybe CopyProtectionAction
a} :: ExtendedDataServices)

instance Core.FromJSON ExtendedDataServices where
  parseJSON :: Value -> Parser ExtendedDataServices
parseJSON =
    String
-> (Object -> Parser ExtendedDataServices)
-> Value
-> Parser ExtendedDataServices
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExtendedDataServices"
      ( \Object
x ->
          Maybe VchipAction
-> Maybe CopyProtectionAction -> ExtendedDataServices
ExtendedDataServices'
            (Maybe VchipAction
 -> Maybe CopyProtectionAction -> ExtendedDataServices)
-> Parser (Maybe VchipAction)
-> Parser (Maybe CopyProtectionAction -> ExtendedDataServices)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe VchipAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"vchipAction")
            Parser (Maybe CopyProtectionAction -> ExtendedDataServices)
-> Parser (Maybe CopyProtectionAction)
-> Parser ExtendedDataServices
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CopyProtectionAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"copyProtectionAction")
      )

instance Prelude.Hashable ExtendedDataServices

instance Prelude.NFData ExtendedDataServices

instance Core.ToJSON ExtendedDataServices where
  toJSON :: ExtendedDataServices -> Value
toJSON ExtendedDataServices' {Maybe CopyProtectionAction
Maybe VchipAction
copyProtectionAction :: Maybe CopyProtectionAction
vchipAction :: Maybe VchipAction
$sel:copyProtectionAction:ExtendedDataServices' :: ExtendedDataServices -> Maybe CopyProtectionAction
$sel:vchipAction:ExtendedDataServices' :: ExtendedDataServices -> Maybe VchipAction
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"vchipAction" Text -> VchipAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VchipAction -> Pair) -> Maybe VchipAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VchipAction
vchipAction,
            (Text
"copyProtectionAction" Text -> CopyProtectionAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CopyProtectionAction -> Pair)
-> Maybe CopyProtectionAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CopyProtectionAction
copyProtectionAction
          ]
      )