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

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

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

-- |
-- Create a value of 'Scte35Descriptor' 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:
--
-- 'scte35DescriptorSettings', 'scte35Descriptor_scte35DescriptorSettings' - SCTE-35 Descriptor Settings.
newScte35Descriptor ::
  -- | 'scte35DescriptorSettings'
  Scte35DescriptorSettings ->
  Scte35Descriptor
newScte35Descriptor :: Scte35DescriptorSettings -> Scte35Descriptor
newScte35Descriptor Scte35DescriptorSettings
pScte35DescriptorSettings_ =
  Scte35Descriptor' :: Scte35DescriptorSettings -> Scte35Descriptor
Scte35Descriptor'
    { $sel:scte35DescriptorSettings:Scte35Descriptor' :: Scte35DescriptorSettings
scte35DescriptorSettings =
        Scte35DescriptorSettings
pScte35DescriptorSettings_
    }

-- | SCTE-35 Descriptor Settings.
scte35Descriptor_scte35DescriptorSettings :: Lens.Lens' Scte35Descriptor Scte35DescriptorSettings
scte35Descriptor_scte35DescriptorSettings :: (Scte35DescriptorSettings -> f Scte35DescriptorSettings)
-> Scte35Descriptor -> f Scte35Descriptor
scte35Descriptor_scte35DescriptorSettings = (Scte35Descriptor -> Scte35DescriptorSettings)
-> (Scte35Descriptor
    -> Scte35DescriptorSettings -> Scte35Descriptor)
-> Lens
     Scte35Descriptor
     Scte35Descriptor
     Scte35DescriptorSettings
     Scte35DescriptorSettings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35Descriptor' {Scte35DescriptorSettings
scte35DescriptorSettings :: Scte35DescriptorSettings
$sel:scte35DescriptorSettings:Scte35Descriptor' :: Scte35Descriptor -> Scte35DescriptorSettings
scte35DescriptorSettings} -> Scte35DescriptorSettings
scte35DescriptorSettings) (\s :: Scte35Descriptor
s@Scte35Descriptor' {} Scte35DescriptorSettings
a -> Scte35Descriptor
s {$sel:scte35DescriptorSettings:Scte35Descriptor' :: Scte35DescriptorSettings
scte35DescriptorSettings = Scte35DescriptorSettings
a} :: Scte35Descriptor)

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

instance Prelude.Hashable Scte35Descriptor

instance Prelude.NFData Scte35Descriptor

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