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

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

-- | SCTE-35 Descriptor settings.
--
-- /See:/ 'newScte35DescriptorSettings' smart constructor.
data Scte35DescriptorSettings = Scte35DescriptorSettings'
  { -- | SCTE-35 Segmentation Descriptor.
    Scte35DescriptorSettings -> Scte35SegmentationDescriptor
segmentationDescriptorScte35DescriptorSettings :: Scte35SegmentationDescriptor
  }
  deriving (Scte35DescriptorSettings -> Scte35DescriptorSettings -> Bool
(Scte35DescriptorSettings -> Scte35DescriptorSettings -> Bool)
-> (Scte35DescriptorSettings -> Scte35DescriptorSettings -> Bool)
-> Eq Scte35DescriptorSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scte35DescriptorSettings -> Scte35DescriptorSettings -> Bool
$c/= :: Scte35DescriptorSettings -> Scte35DescriptorSettings -> Bool
== :: Scte35DescriptorSettings -> Scte35DescriptorSettings -> Bool
$c== :: Scte35DescriptorSettings -> Scte35DescriptorSettings -> Bool
Prelude.Eq, ReadPrec [Scte35DescriptorSettings]
ReadPrec Scte35DescriptorSettings
Int -> ReadS Scte35DescriptorSettings
ReadS [Scte35DescriptorSettings]
(Int -> ReadS Scte35DescriptorSettings)
-> ReadS [Scte35DescriptorSettings]
-> ReadPrec Scte35DescriptorSettings
-> ReadPrec [Scte35DescriptorSettings]
-> Read Scte35DescriptorSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Scte35DescriptorSettings]
$creadListPrec :: ReadPrec [Scte35DescriptorSettings]
readPrec :: ReadPrec Scte35DescriptorSettings
$creadPrec :: ReadPrec Scte35DescriptorSettings
readList :: ReadS [Scte35DescriptorSettings]
$creadList :: ReadS [Scte35DescriptorSettings]
readsPrec :: Int -> ReadS Scte35DescriptorSettings
$creadsPrec :: Int -> ReadS Scte35DescriptorSettings
Prelude.Read, Int -> Scte35DescriptorSettings -> ShowS
[Scte35DescriptorSettings] -> ShowS
Scte35DescriptorSettings -> String
(Int -> Scte35DescriptorSettings -> ShowS)
-> (Scte35DescriptorSettings -> String)
-> ([Scte35DescriptorSettings] -> ShowS)
-> Show Scte35DescriptorSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scte35DescriptorSettings] -> ShowS
$cshowList :: [Scte35DescriptorSettings] -> ShowS
show :: Scte35DescriptorSettings -> String
$cshow :: Scte35DescriptorSettings -> String
showsPrec :: Int -> Scte35DescriptorSettings -> ShowS
$cshowsPrec :: Int -> Scte35DescriptorSettings -> ShowS
Prelude.Show, (forall x.
 Scte35DescriptorSettings -> Rep Scte35DescriptorSettings x)
-> (forall x.
    Rep Scte35DescriptorSettings x -> Scte35DescriptorSettings)
-> Generic Scte35DescriptorSettings
forall x.
Rep Scte35DescriptorSettings x -> Scte35DescriptorSettings
forall x.
Scte35DescriptorSettings -> Rep Scte35DescriptorSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep Scte35DescriptorSettings x -> Scte35DescriptorSettings
$cfrom :: forall x.
Scte35DescriptorSettings -> Rep Scte35DescriptorSettings x
Prelude.Generic)

-- |
-- Create a value of 'Scte35DescriptorSettings' 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:
--
-- 'segmentationDescriptorScte35DescriptorSettings', 'scte35DescriptorSettings_segmentationDescriptorScte35DescriptorSettings' - SCTE-35 Segmentation Descriptor.
newScte35DescriptorSettings ::
  -- | 'segmentationDescriptorScte35DescriptorSettings'
  Scte35SegmentationDescriptor ->
  Scte35DescriptorSettings
newScte35DescriptorSettings :: Scte35SegmentationDescriptor -> Scte35DescriptorSettings
newScte35DescriptorSettings
  Scte35SegmentationDescriptor
pSegmentationDescriptorScte35DescriptorSettings_ =
    Scte35DescriptorSettings' :: Scte35SegmentationDescriptor -> Scte35DescriptorSettings
Scte35DescriptorSettings'
      { $sel:segmentationDescriptorScte35DescriptorSettings:Scte35DescriptorSettings' :: Scte35SegmentationDescriptor
segmentationDescriptorScte35DescriptorSettings =
          Scte35SegmentationDescriptor
pSegmentationDescriptorScte35DescriptorSettings_
      }

-- | SCTE-35 Segmentation Descriptor.
scte35DescriptorSettings_segmentationDescriptorScte35DescriptorSettings :: Lens.Lens' Scte35DescriptorSettings Scte35SegmentationDescriptor
scte35DescriptorSettings_segmentationDescriptorScte35DescriptorSettings :: (Scte35SegmentationDescriptor -> f Scte35SegmentationDescriptor)
-> Scte35DescriptorSettings -> f Scte35DescriptorSettings
scte35DescriptorSettings_segmentationDescriptorScte35DescriptorSettings = (Scte35DescriptorSettings -> Scte35SegmentationDescriptor)
-> (Scte35DescriptorSettings
    -> Scte35SegmentationDescriptor -> Scte35DescriptorSettings)
-> Lens
     Scte35DescriptorSettings
     Scte35DescriptorSettings
     Scte35SegmentationDescriptor
     Scte35SegmentationDescriptor
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35DescriptorSettings' {Scte35SegmentationDescriptor
segmentationDescriptorScte35DescriptorSettings :: Scte35SegmentationDescriptor
$sel:segmentationDescriptorScte35DescriptorSettings:Scte35DescriptorSettings' :: Scte35DescriptorSettings -> Scte35SegmentationDescriptor
segmentationDescriptorScte35DescriptorSettings} -> Scte35SegmentationDescriptor
segmentationDescriptorScte35DescriptorSettings) (\s :: Scte35DescriptorSettings
s@Scte35DescriptorSettings' {} Scte35SegmentationDescriptor
a -> Scte35DescriptorSettings
s {$sel:segmentationDescriptorScte35DescriptorSettings:Scte35DescriptorSettings' :: Scte35SegmentationDescriptor
segmentationDescriptorScte35DescriptorSettings = Scte35SegmentationDescriptor
a} :: Scte35DescriptorSettings)

instance Core.FromJSON Scte35DescriptorSettings where
  parseJSON :: Value -> Parser Scte35DescriptorSettings
parseJSON =
    String
-> (Object -> Parser Scte35DescriptorSettings)
-> Value
-> Parser Scte35DescriptorSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Scte35DescriptorSettings"
      ( \Object
x ->
          Scte35SegmentationDescriptor -> Scte35DescriptorSettings
Scte35DescriptorSettings'
            (Scte35SegmentationDescriptor -> Scte35DescriptorSettings)
-> Parser Scte35SegmentationDescriptor
-> Parser Scte35DescriptorSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            Object -> Text -> Parser Scte35SegmentationDescriptor
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"segmentationDescriptorScte35DescriptorSettings"
                        )
      )

instance Prelude.Hashable Scte35DescriptorSettings

instance Prelude.NFData Scte35DescriptorSettings

instance Core.ToJSON Scte35DescriptorSettings where
  toJSON :: Scte35DescriptorSettings -> Value
toJSON Scte35DescriptorSettings' {Scte35SegmentationDescriptor
segmentationDescriptorScte35DescriptorSettings :: Scte35SegmentationDescriptor
$sel:segmentationDescriptorScte35DescriptorSettings:Scte35DescriptorSettings' :: Scte35DescriptorSettings -> Scte35SegmentationDescriptor
..} =
    [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
"segmentationDescriptorScte35DescriptorSettings"
                  Text -> Scte35SegmentationDescriptor -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Scte35SegmentationDescriptor
segmentationDescriptorScte35DescriptorSettings
              )
          ]
      )