{-# 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.NielsenConfiguration
-- 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.NielsenConfiguration 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.NielsenPcmToId3TaggingState
import qualified Amazonka.Prelude as Prelude

-- | Nielsen Configuration
--
-- /See:/ 'newNielsenConfiguration' smart constructor.
data NielsenConfiguration = NielsenConfiguration'
  { -- | Enter the Distributor ID assigned to your organization by Nielsen.
    NielsenConfiguration -> Maybe Text
distributorId :: Prelude.Maybe Prelude.Text,
    -- | Enables Nielsen PCM to ID3 tagging
    NielsenConfiguration -> Maybe NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging :: Prelude.Maybe NielsenPcmToId3TaggingState
  }
  deriving (NielsenConfiguration -> NielsenConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NielsenConfiguration -> NielsenConfiguration -> Bool
$c/= :: NielsenConfiguration -> NielsenConfiguration -> Bool
== :: NielsenConfiguration -> NielsenConfiguration -> Bool
$c== :: NielsenConfiguration -> NielsenConfiguration -> Bool
Prelude.Eq, ReadPrec [NielsenConfiguration]
ReadPrec NielsenConfiguration
Int -> ReadS NielsenConfiguration
ReadS [NielsenConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NielsenConfiguration]
$creadListPrec :: ReadPrec [NielsenConfiguration]
readPrec :: ReadPrec NielsenConfiguration
$creadPrec :: ReadPrec NielsenConfiguration
readList :: ReadS [NielsenConfiguration]
$creadList :: ReadS [NielsenConfiguration]
readsPrec :: Int -> ReadS NielsenConfiguration
$creadsPrec :: Int -> ReadS NielsenConfiguration
Prelude.Read, Int -> NielsenConfiguration -> ShowS
[NielsenConfiguration] -> ShowS
NielsenConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NielsenConfiguration] -> ShowS
$cshowList :: [NielsenConfiguration] -> ShowS
show :: NielsenConfiguration -> String
$cshow :: NielsenConfiguration -> String
showsPrec :: Int -> NielsenConfiguration -> ShowS
$cshowsPrec :: Int -> NielsenConfiguration -> ShowS
Prelude.Show, forall x. Rep NielsenConfiguration x -> NielsenConfiguration
forall x. NielsenConfiguration -> Rep NielsenConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NielsenConfiguration x -> NielsenConfiguration
$cfrom :: forall x. NielsenConfiguration -> Rep NielsenConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'NielsenConfiguration' 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:
--
-- 'distributorId', 'nielsenConfiguration_distributorId' - Enter the Distributor ID assigned to your organization by Nielsen.
--
-- 'nielsenPcmToId3Tagging', 'nielsenConfiguration_nielsenPcmToId3Tagging' - Enables Nielsen PCM to ID3 tagging
newNielsenConfiguration ::
  NielsenConfiguration
newNielsenConfiguration :: NielsenConfiguration
newNielsenConfiguration =
  NielsenConfiguration'
    { $sel:distributorId:NielsenConfiguration' :: Maybe Text
distributorId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nielsenPcmToId3Tagging:NielsenConfiguration' :: Maybe NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging = forall a. Maybe a
Prelude.Nothing
    }

-- | Enter the Distributor ID assigned to your organization by Nielsen.
nielsenConfiguration_distributorId :: Lens.Lens' NielsenConfiguration (Prelude.Maybe Prelude.Text)
nielsenConfiguration_distributorId :: Lens' NielsenConfiguration (Maybe Text)
nielsenConfiguration_distributorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NielsenConfiguration' {Maybe Text
distributorId :: Maybe Text
$sel:distributorId:NielsenConfiguration' :: NielsenConfiguration -> Maybe Text
distributorId} -> Maybe Text
distributorId) (\s :: NielsenConfiguration
s@NielsenConfiguration' {} Maybe Text
a -> NielsenConfiguration
s {$sel:distributorId:NielsenConfiguration' :: Maybe Text
distributorId = Maybe Text
a} :: NielsenConfiguration)

-- | Enables Nielsen PCM to ID3 tagging
nielsenConfiguration_nielsenPcmToId3Tagging :: Lens.Lens' NielsenConfiguration (Prelude.Maybe NielsenPcmToId3TaggingState)
nielsenConfiguration_nielsenPcmToId3Tagging :: Lens' NielsenConfiguration (Maybe NielsenPcmToId3TaggingState)
nielsenConfiguration_nielsenPcmToId3Tagging = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NielsenConfiguration' {Maybe NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging :: Maybe NielsenPcmToId3TaggingState
$sel:nielsenPcmToId3Tagging:NielsenConfiguration' :: NielsenConfiguration -> Maybe NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging} -> Maybe NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging) (\s :: NielsenConfiguration
s@NielsenConfiguration' {} Maybe NielsenPcmToId3TaggingState
a -> NielsenConfiguration
s {$sel:nielsenPcmToId3Tagging:NielsenConfiguration' :: Maybe NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging = Maybe NielsenPcmToId3TaggingState
a} :: NielsenConfiguration)

instance Data.FromJSON NielsenConfiguration where
  parseJSON :: Value -> Parser NielsenConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NielsenConfiguration"
      ( \Object
x ->
          Maybe Text
-> Maybe NielsenPcmToId3TaggingState -> NielsenConfiguration
NielsenConfiguration'
            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
"distributorId")
            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
"nielsenPcmToId3Tagging")
      )

instance Prelude.Hashable NielsenConfiguration where
  hashWithSalt :: Int -> NielsenConfiguration -> Int
hashWithSalt Int
_salt NielsenConfiguration' {Maybe Text
Maybe NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging :: Maybe NielsenPcmToId3TaggingState
distributorId :: Maybe Text
$sel:nielsenPcmToId3Tagging:NielsenConfiguration' :: NielsenConfiguration -> Maybe NielsenPcmToId3TaggingState
$sel:distributorId:NielsenConfiguration' :: NielsenConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
distributorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging

instance Prelude.NFData NielsenConfiguration where
  rnf :: NielsenConfiguration -> ()
rnf NielsenConfiguration' {Maybe Text
Maybe NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging :: Maybe NielsenPcmToId3TaggingState
distributorId :: Maybe Text
$sel:nielsenPcmToId3Tagging:NielsenConfiguration' :: NielsenConfiguration -> Maybe NielsenPcmToId3TaggingState
$sel:distributorId:NielsenConfiguration' :: NielsenConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
distributorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging

instance Data.ToJSON NielsenConfiguration where
  toJSON :: NielsenConfiguration -> Value
toJSON NielsenConfiguration' {Maybe Text
Maybe NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging :: Maybe NielsenPcmToId3TaggingState
distributorId :: Maybe Text
$sel:nielsenPcmToId3Tagging:NielsenConfiguration' :: NielsenConfiguration -> Maybe NielsenPcmToId3TaggingState
$sel:distributorId:NielsenConfiguration' :: NielsenConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"distributorId" 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 Text
distributorId,
            (Key
"nielsenPcmToId3Tagging" 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 NielsenPcmToId3TaggingState
nielsenPcmToId3Tagging
          ]
      )