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

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

-- | Nielsen CBET
--
-- /See:/ 'newNielsenCBET' smart constructor.
data NielsenCBET = NielsenCBET'
  { -- | Enter the CBET check digits to use in the watermark.
    NielsenCBET -> Text
cbetCheckDigitString :: Prelude.Text,
    -- | Determines the method of CBET insertion mode when prior encoding is
    -- detected on the same layer.
    NielsenCBET -> NielsenWatermarksCbetStepaside
cbetStepaside :: NielsenWatermarksCbetStepaside,
    -- | Enter the CBET Source ID (CSID) to use in the watermark
    NielsenCBET -> Text
csid :: Prelude.Text
  }
  deriving (NielsenCBET -> NielsenCBET -> Bool
(NielsenCBET -> NielsenCBET -> Bool)
-> (NielsenCBET -> NielsenCBET -> Bool) -> Eq NielsenCBET
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NielsenCBET -> NielsenCBET -> Bool
$c/= :: NielsenCBET -> NielsenCBET -> Bool
== :: NielsenCBET -> NielsenCBET -> Bool
$c== :: NielsenCBET -> NielsenCBET -> Bool
Prelude.Eq, ReadPrec [NielsenCBET]
ReadPrec NielsenCBET
Int -> ReadS NielsenCBET
ReadS [NielsenCBET]
(Int -> ReadS NielsenCBET)
-> ReadS [NielsenCBET]
-> ReadPrec NielsenCBET
-> ReadPrec [NielsenCBET]
-> Read NielsenCBET
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NielsenCBET]
$creadListPrec :: ReadPrec [NielsenCBET]
readPrec :: ReadPrec NielsenCBET
$creadPrec :: ReadPrec NielsenCBET
readList :: ReadS [NielsenCBET]
$creadList :: ReadS [NielsenCBET]
readsPrec :: Int -> ReadS NielsenCBET
$creadsPrec :: Int -> ReadS NielsenCBET
Prelude.Read, Int -> NielsenCBET -> ShowS
[NielsenCBET] -> ShowS
NielsenCBET -> String
(Int -> NielsenCBET -> ShowS)
-> (NielsenCBET -> String)
-> ([NielsenCBET] -> ShowS)
-> Show NielsenCBET
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NielsenCBET] -> ShowS
$cshowList :: [NielsenCBET] -> ShowS
show :: NielsenCBET -> String
$cshow :: NielsenCBET -> String
showsPrec :: Int -> NielsenCBET -> ShowS
$cshowsPrec :: Int -> NielsenCBET -> ShowS
Prelude.Show, (forall x. NielsenCBET -> Rep NielsenCBET x)
-> (forall x. Rep NielsenCBET x -> NielsenCBET)
-> Generic NielsenCBET
forall x. Rep NielsenCBET x -> NielsenCBET
forall x. NielsenCBET -> Rep NielsenCBET x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NielsenCBET x -> NielsenCBET
$cfrom :: forall x. NielsenCBET -> Rep NielsenCBET x
Prelude.Generic)

-- |
-- Create a value of 'NielsenCBET' 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:
--
-- 'cbetCheckDigitString', 'nielsenCBET_cbetCheckDigitString' - Enter the CBET check digits to use in the watermark.
--
-- 'cbetStepaside', 'nielsenCBET_cbetStepaside' - Determines the method of CBET insertion mode when prior encoding is
-- detected on the same layer.
--
-- 'csid', 'nielsenCBET_csid' - Enter the CBET Source ID (CSID) to use in the watermark
newNielsenCBET ::
  -- | 'cbetCheckDigitString'
  Prelude.Text ->
  -- | 'cbetStepaside'
  NielsenWatermarksCbetStepaside ->
  -- | 'csid'
  Prelude.Text ->
  NielsenCBET
newNielsenCBET :: Text -> NielsenWatermarksCbetStepaside -> Text -> NielsenCBET
newNielsenCBET
  Text
pCbetCheckDigitString_
  NielsenWatermarksCbetStepaside
pCbetStepaside_
  Text
pCsid_ =
    NielsenCBET' :: Text -> NielsenWatermarksCbetStepaside -> Text -> NielsenCBET
NielsenCBET'
      { $sel:cbetCheckDigitString:NielsenCBET' :: Text
cbetCheckDigitString =
          Text
pCbetCheckDigitString_,
        $sel:cbetStepaside:NielsenCBET' :: NielsenWatermarksCbetStepaside
cbetStepaside = NielsenWatermarksCbetStepaside
pCbetStepaside_,
        $sel:csid:NielsenCBET' :: Text
csid = Text
pCsid_
      }

-- | Enter the CBET check digits to use in the watermark.
nielsenCBET_cbetCheckDigitString :: Lens.Lens' NielsenCBET Prelude.Text
nielsenCBET_cbetCheckDigitString :: (Text -> f Text) -> NielsenCBET -> f NielsenCBET
nielsenCBET_cbetCheckDigitString = (NielsenCBET -> Text)
-> (NielsenCBET -> Text -> NielsenCBET)
-> Lens NielsenCBET NielsenCBET Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NielsenCBET' {Text
cbetCheckDigitString :: Text
$sel:cbetCheckDigitString:NielsenCBET' :: NielsenCBET -> Text
cbetCheckDigitString} -> Text
cbetCheckDigitString) (\s :: NielsenCBET
s@NielsenCBET' {} Text
a -> NielsenCBET
s {$sel:cbetCheckDigitString:NielsenCBET' :: Text
cbetCheckDigitString = Text
a} :: NielsenCBET)

-- | Determines the method of CBET insertion mode when prior encoding is
-- detected on the same layer.
nielsenCBET_cbetStepaside :: Lens.Lens' NielsenCBET NielsenWatermarksCbetStepaside
nielsenCBET_cbetStepaside :: (NielsenWatermarksCbetStepaside
 -> f NielsenWatermarksCbetStepaside)
-> NielsenCBET -> f NielsenCBET
nielsenCBET_cbetStepaside = (NielsenCBET -> NielsenWatermarksCbetStepaside)
-> (NielsenCBET -> NielsenWatermarksCbetStepaside -> NielsenCBET)
-> Lens
     NielsenCBET
     NielsenCBET
     NielsenWatermarksCbetStepaside
     NielsenWatermarksCbetStepaside
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NielsenCBET' {NielsenWatermarksCbetStepaside
cbetStepaside :: NielsenWatermarksCbetStepaside
$sel:cbetStepaside:NielsenCBET' :: NielsenCBET -> NielsenWatermarksCbetStepaside
cbetStepaside} -> NielsenWatermarksCbetStepaside
cbetStepaside) (\s :: NielsenCBET
s@NielsenCBET' {} NielsenWatermarksCbetStepaside
a -> NielsenCBET
s {$sel:cbetStepaside:NielsenCBET' :: NielsenWatermarksCbetStepaside
cbetStepaside = NielsenWatermarksCbetStepaside
a} :: NielsenCBET)

-- | Enter the CBET Source ID (CSID) to use in the watermark
nielsenCBET_csid :: Lens.Lens' NielsenCBET Prelude.Text
nielsenCBET_csid :: (Text -> f Text) -> NielsenCBET -> f NielsenCBET
nielsenCBET_csid = (NielsenCBET -> Text)
-> (NielsenCBET -> Text -> NielsenCBET)
-> Lens NielsenCBET NielsenCBET Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NielsenCBET' {Text
csid :: Text
$sel:csid:NielsenCBET' :: NielsenCBET -> Text
csid} -> Text
csid) (\s :: NielsenCBET
s@NielsenCBET' {} Text
a -> NielsenCBET
s {$sel:csid:NielsenCBET' :: Text
csid = Text
a} :: NielsenCBET)

instance Core.FromJSON NielsenCBET where
  parseJSON :: Value -> Parser NielsenCBET
parseJSON =
    String
-> (Object -> Parser NielsenCBET) -> Value -> Parser NielsenCBET
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NielsenCBET"
      ( \Object
x ->
          Text -> NielsenWatermarksCbetStepaside -> Text -> NielsenCBET
NielsenCBET'
            (Text -> NielsenWatermarksCbetStepaside -> Text -> NielsenCBET)
-> Parser Text
-> Parser (NielsenWatermarksCbetStepaside -> Text -> NielsenCBET)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"cbetCheckDigitString")
            Parser (NielsenWatermarksCbetStepaside -> Text -> NielsenCBET)
-> Parser NielsenWatermarksCbetStepaside
-> Parser (Text -> NielsenCBET)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser NielsenWatermarksCbetStepaside
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"cbetStepaside")
            Parser (Text -> NielsenCBET) -> Parser Text -> Parser NielsenCBET
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"csid")
      )

instance Prelude.Hashable NielsenCBET

instance Prelude.NFData NielsenCBET

instance Core.ToJSON NielsenCBET where
  toJSON :: NielsenCBET -> Value
toJSON NielsenCBET' {Text
NielsenWatermarksCbetStepaside
csid :: Text
cbetStepaside :: NielsenWatermarksCbetStepaside
cbetCheckDigitString :: Text
$sel:csid:NielsenCBET' :: NielsenCBET -> Text
$sel:cbetStepaside:NielsenCBET' :: NielsenCBET -> NielsenWatermarksCbetStepaside
$sel:cbetCheckDigitString:NielsenCBET' :: NielsenCBET -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"cbetCheckDigitString"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
cbetCheckDigitString
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"cbetStepaside" Text -> NielsenWatermarksCbetStepaside -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NielsenWatermarksCbetStepaside
cbetStepaside),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"csid" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
csid)
          ]
      )