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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Settings for your Nielsen configuration. If you don\'t do Nielsen
-- measurement and analytics, ignore these settings. When you enable
-- Nielsen configuration (nielsenConfiguration), MediaConvert enables PCM
-- to ID3 tagging for all outputs in the job. To enable Nielsen
-- configuration programmatically, include an instance of
-- nielsenConfiguration in your JSON job specification. Even if you don\'t
-- include any children of nielsenConfiguration, you still enable the
-- setting.
--
-- /See:/ 'newNielsenConfiguration' smart constructor.
data NielsenConfiguration = NielsenConfiguration'
  { -- | Nielsen has discontinued the use of breakout code functionality. If you
    -- must include this property, set the value to zero.
    NielsenConfiguration -> Maybe Natural
breakoutCode :: Prelude.Maybe Prelude.Natural,
    -- | Use Distributor ID (DistributorID) to specify the distributor ID that is
    -- assigned to your organization by Neilsen.
    NielsenConfiguration -> Maybe Text
distributorId :: Prelude.Maybe Prelude.Text
  }
  deriving (NielsenConfiguration -> NielsenConfiguration -> Bool
(NielsenConfiguration -> NielsenConfiguration -> Bool)
-> (NielsenConfiguration -> NielsenConfiguration -> Bool)
-> Eq NielsenConfiguration
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]
(Int -> ReadS NielsenConfiguration)
-> ReadS [NielsenConfiguration]
-> ReadPrec NielsenConfiguration
-> ReadPrec [NielsenConfiguration]
-> Read 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
(Int -> NielsenConfiguration -> ShowS)
-> (NielsenConfiguration -> String)
-> ([NielsenConfiguration] -> ShowS)
-> Show NielsenConfiguration
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. NielsenConfiguration -> Rep NielsenConfiguration x)
-> (forall x. Rep NielsenConfiguration x -> NielsenConfiguration)
-> Generic NielsenConfiguration
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:
--
-- 'breakoutCode', 'nielsenConfiguration_breakoutCode' - Nielsen has discontinued the use of breakout code functionality. If you
-- must include this property, set the value to zero.
--
-- 'distributorId', 'nielsenConfiguration_distributorId' - Use Distributor ID (DistributorID) to specify the distributor ID that is
-- assigned to your organization by Neilsen.
newNielsenConfiguration ::
  NielsenConfiguration
newNielsenConfiguration :: NielsenConfiguration
newNielsenConfiguration =
  NielsenConfiguration' :: Maybe Natural -> Maybe Text -> NielsenConfiguration
NielsenConfiguration'
    { $sel:breakoutCode:NielsenConfiguration' :: Maybe Natural
breakoutCode =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:distributorId:NielsenConfiguration' :: Maybe Text
distributorId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Nielsen has discontinued the use of breakout code functionality. If you
-- must include this property, set the value to zero.
nielsenConfiguration_breakoutCode :: Lens.Lens' NielsenConfiguration (Prelude.Maybe Prelude.Natural)
nielsenConfiguration_breakoutCode :: (Maybe Natural -> f (Maybe Natural))
-> NielsenConfiguration -> f NielsenConfiguration
nielsenConfiguration_breakoutCode = (NielsenConfiguration -> Maybe Natural)
-> (NielsenConfiguration -> Maybe Natural -> NielsenConfiguration)
-> Lens
     NielsenConfiguration
     NielsenConfiguration
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NielsenConfiguration' {Maybe Natural
breakoutCode :: Maybe Natural
$sel:breakoutCode:NielsenConfiguration' :: NielsenConfiguration -> Maybe Natural
breakoutCode} -> Maybe Natural
breakoutCode) (\s :: NielsenConfiguration
s@NielsenConfiguration' {} Maybe Natural
a -> NielsenConfiguration
s {$sel:breakoutCode:NielsenConfiguration' :: Maybe Natural
breakoutCode = Maybe Natural
a} :: NielsenConfiguration)

-- | Use Distributor ID (DistributorID) to specify the distributor ID that is
-- assigned to your organization by Neilsen.
nielsenConfiguration_distributorId :: Lens.Lens' NielsenConfiguration (Prelude.Maybe Prelude.Text)
nielsenConfiguration_distributorId :: (Maybe Text -> f (Maybe Text))
-> NielsenConfiguration -> f NielsenConfiguration
nielsenConfiguration_distributorId = (NielsenConfiguration -> Maybe Text)
-> (NielsenConfiguration -> Maybe Text -> NielsenConfiguration)
-> Lens
     NielsenConfiguration NielsenConfiguration (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON NielsenConfiguration where
  parseJSON :: Value -> Parser NielsenConfiguration
parseJSON =
    String
-> (Object -> Parser NielsenConfiguration)
-> Value
-> Parser NielsenConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NielsenConfiguration"
      ( \Object
x ->
          Maybe Natural -> Maybe Text -> NielsenConfiguration
NielsenConfiguration'
            (Maybe Natural -> Maybe Text -> NielsenConfiguration)
-> Parser (Maybe Natural)
-> Parser (Maybe Text -> NielsenConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"breakoutCode")
            Parser (Maybe Text -> NielsenConfiguration)
-> Parser (Maybe Text) -> Parser NielsenConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"distributorId")
      )

instance Prelude.Hashable NielsenConfiguration

instance Prelude.NFData NielsenConfiguration

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