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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 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,
    -- | 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
  }
  deriving (ExtendedDataServices -> ExtendedDataServices -> Bool
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]
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
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. 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:
--
-- '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.
--
-- '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.
newExtendedDataServices ::
  ExtendedDataServices
newExtendedDataServices :: ExtendedDataServices
newExtendedDataServices =
  ExtendedDataServices'
    { $sel:copyProtectionAction:ExtendedDataServices' :: Maybe CopyProtectionAction
copyProtectionAction =
        forall a. Maybe a
Prelude.Nothing,
      $sel:vchipAction:ExtendedDataServices' :: Maybe VchipAction
vchipAction = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' ExtendedDataServices (Maybe CopyProtectionAction)
extendedDataServices_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)

-- | 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 :: Lens' ExtendedDataServices (Maybe VchipAction)
extendedDataServices_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)

instance Data.FromJSON ExtendedDataServices where
  parseJSON :: Value -> Parser ExtendedDataServices
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ExtendedDataServices"
      ( \Object
x ->
          Maybe CopyProtectionAction
-> Maybe VchipAction -> ExtendedDataServices
ExtendedDataServices'
            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
"copyProtectionAction")
            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
"vchipAction")
      )

instance Prelude.Hashable ExtendedDataServices where
  hashWithSalt :: Int -> ExtendedDataServices -> Int
hashWithSalt Int
_salt ExtendedDataServices' {Maybe CopyProtectionAction
Maybe VchipAction
vchipAction :: Maybe VchipAction
copyProtectionAction :: Maybe CopyProtectionAction
$sel:vchipAction:ExtendedDataServices' :: ExtendedDataServices -> Maybe VchipAction
$sel:copyProtectionAction:ExtendedDataServices' :: ExtendedDataServices -> Maybe CopyProtectionAction
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CopyProtectionAction
copyProtectionAction
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VchipAction
vchipAction

instance Prelude.NFData ExtendedDataServices where
  rnf :: ExtendedDataServices -> ()
rnf ExtendedDataServices' {Maybe CopyProtectionAction
Maybe VchipAction
vchipAction :: Maybe VchipAction
copyProtectionAction :: Maybe CopyProtectionAction
$sel:vchipAction:ExtendedDataServices' :: ExtendedDataServices -> Maybe VchipAction
$sel:copyProtectionAction:ExtendedDataServices' :: ExtendedDataServices -> Maybe CopyProtectionAction
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CopyProtectionAction
copyProtectionAction
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VchipAction
vchipAction

instance Data.ToJSON ExtendedDataServices where
  toJSON :: ExtendedDataServices -> Value
toJSON ExtendedDataServices' {Maybe CopyProtectionAction
Maybe VchipAction
vchipAction :: Maybe VchipAction
copyProtectionAction :: Maybe CopyProtectionAction
$sel:vchipAction:ExtendedDataServices' :: ExtendedDataServices -> Maybe VchipAction
$sel:copyProtectionAction:ExtendedDataServices' :: ExtendedDataServices -> Maybe CopyProtectionAction
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"copyProtectionAction" 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 CopyProtectionAction
copyProtectionAction,
            (Key
"vchipAction" 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 VchipAction
vchipAction
          ]
      )