{-# 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-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.NielsenCBET 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.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
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]
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
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. 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'
      { $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 :: Lens' NielsenCBET Text
nielsenCBET_cbetCheckDigitString = 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 :: Lens' NielsenCBET NielsenWatermarksCbetStepaside
nielsenCBET_cbetStepaside = 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 :: Lens' NielsenCBET Text
nielsenCBET_csid = 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 Data.FromJSON NielsenCBET where
  parseJSON :: Value -> Parser NielsenCBET
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NielsenCBET"
      ( \Object
x ->
          Text -> NielsenWatermarksCbetStepaside -> Text -> NielsenCBET
NielsenCBET'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"cbetCheckDigitString")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"cbetStepaside")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"csid")
      )

instance Prelude.Hashable NielsenCBET where
  hashWithSalt :: Int -> NielsenCBET -> Int
hashWithSalt Int
_salt NielsenCBET' {Text
NielsenWatermarksCbetStepaside
csid :: Text
cbetStepaside :: NielsenWatermarksCbetStepaside
cbetCheckDigitString :: Text
$sel:csid:NielsenCBET' :: NielsenCBET -> Text
$sel:cbetStepaside:NielsenCBET' :: NielsenCBET -> NielsenWatermarksCbetStepaside
$sel:cbetCheckDigitString:NielsenCBET' :: NielsenCBET -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
cbetCheckDigitString
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NielsenWatermarksCbetStepaside
cbetStepaside
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
csid

instance Prelude.NFData NielsenCBET where
  rnf :: NielsenCBET -> ()
rnf NielsenCBET' {Text
NielsenWatermarksCbetStepaside
csid :: Text
cbetStepaside :: NielsenWatermarksCbetStepaside
cbetCheckDigitString :: Text
$sel:csid:NielsenCBET' :: NielsenCBET -> Text
$sel:cbetStepaside:NielsenCBET' :: NielsenCBET -> NielsenWatermarksCbetStepaside
$sel:cbetCheckDigitString:NielsenCBET' :: NielsenCBET -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
cbetCheckDigitString
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NielsenWatermarksCbetStepaside
cbetStepaside
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
csid

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"cbetCheckDigitString"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
cbetCheckDigitString
              ),
            forall a. a -> Maybe a
Prelude.Just (Key
"cbetStepaside" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NielsenWatermarksCbetStepaside
cbetStepaside),
            forall a. a -> Maybe a
Prelude.Just (Key
"csid" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
csid)
          ]
      )