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

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

-- | Settings for a SCTE-35 time_signal.
--
-- /See:/ 'newScte35TimeSignalScheduleActionSettings' smart constructor.
data Scte35TimeSignalScheduleActionSettings = Scte35TimeSignalScheduleActionSettings'
  { -- | The list of SCTE-35 descriptors accompanying the SCTE-35 time_signal.
    Scte35TimeSignalScheduleActionSettings -> [Scte35Descriptor]
scte35Descriptors :: [Scte35Descriptor]
  }
  deriving (Scte35TimeSignalScheduleActionSettings
-> Scte35TimeSignalScheduleActionSettings -> Bool
(Scte35TimeSignalScheduleActionSettings
 -> Scte35TimeSignalScheduleActionSettings -> Bool)
-> (Scte35TimeSignalScheduleActionSettings
    -> Scte35TimeSignalScheduleActionSettings -> Bool)
-> Eq Scte35TimeSignalScheduleActionSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scte35TimeSignalScheduleActionSettings
-> Scte35TimeSignalScheduleActionSettings -> Bool
$c/= :: Scte35TimeSignalScheduleActionSettings
-> Scte35TimeSignalScheduleActionSettings -> Bool
== :: Scte35TimeSignalScheduleActionSettings
-> Scte35TimeSignalScheduleActionSettings -> Bool
$c== :: Scte35TimeSignalScheduleActionSettings
-> Scte35TimeSignalScheduleActionSettings -> Bool
Prelude.Eq, ReadPrec [Scte35TimeSignalScheduleActionSettings]
ReadPrec Scte35TimeSignalScheduleActionSettings
Int -> ReadS Scte35TimeSignalScheduleActionSettings
ReadS [Scte35TimeSignalScheduleActionSettings]
(Int -> ReadS Scte35TimeSignalScheduleActionSettings)
-> ReadS [Scte35TimeSignalScheduleActionSettings]
-> ReadPrec Scte35TimeSignalScheduleActionSettings
-> ReadPrec [Scte35TimeSignalScheduleActionSettings]
-> Read Scte35TimeSignalScheduleActionSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Scte35TimeSignalScheduleActionSettings]
$creadListPrec :: ReadPrec [Scte35TimeSignalScheduleActionSettings]
readPrec :: ReadPrec Scte35TimeSignalScheduleActionSettings
$creadPrec :: ReadPrec Scte35TimeSignalScheduleActionSettings
readList :: ReadS [Scte35TimeSignalScheduleActionSettings]
$creadList :: ReadS [Scte35TimeSignalScheduleActionSettings]
readsPrec :: Int -> ReadS Scte35TimeSignalScheduleActionSettings
$creadsPrec :: Int -> ReadS Scte35TimeSignalScheduleActionSettings
Prelude.Read, Int -> Scte35TimeSignalScheduleActionSettings -> ShowS
[Scte35TimeSignalScheduleActionSettings] -> ShowS
Scte35TimeSignalScheduleActionSettings -> String
(Int -> Scte35TimeSignalScheduleActionSettings -> ShowS)
-> (Scte35TimeSignalScheduleActionSettings -> String)
-> ([Scte35TimeSignalScheduleActionSettings] -> ShowS)
-> Show Scte35TimeSignalScheduleActionSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scte35TimeSignalScheduleActionSettings] -> ShowS
$cshowList :: [Scte35TimeSignalScheduleActionSettings] -> ShowS
show :: Scte35TimeSignalScheduleActionSettings -> String
$cshow :: Scte35TimeSignalScheduleActionSettings -> String
showsPrec :: Int -> Scte35TimeSignalScheduleActionSettings -> ShowS
$cshowsPrec :: Int -> Scte35TimeSignalScheduleActionSettings -> ShowS
Prelude.Show, (forall x.
 Scte35TimeSignalScheduleActionSettings
 -> Rep Scte35TimeSignalScheduleActionSettings x)
-> (forall x.
    Rep Scte35TimeSignalScheduleActionSettings x
    -> Scte35TimeSignalScheduleActionSettings)
-> Generic Scte35TimeSignalScheduleActionSettings
forall x.
Rep Scte35TimeSignalScheduleActionSettings x
-> Scte35TimeSignalScheduleActionSettings
forall x.
Scte35TimeSignalScheduleActionSettings
-> Rep Scte35TimeSignalScheduleActionSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep Scte35TimeSignalScheduleActionSettings x
-> Scte35TimeSignalScheduleActionSettings
$cfrom :: forall x.
Scte35TimeSignalScheduleActionSettings
-> Rep Scte35TimeSignalScheduleActionSettings x
Prelude.Generic)

-- |
-- Create a value of 'Scte35TimeSignalScheduleActionSettings' 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:
--
-- 'scte35Descriptors', 'scte35TimeSignalScheduleActionSettings_scte35Descriptors' - The list of SCTE-35 descriptors accompanying the SCTE-35 time_signal.
newScte35TimeSignalScheduleActionSettings ::
  Scte35TimeSignalScheduleActionSettings
newScte35TimeSignalScheduleActionSettings :: Scte35TimeSignalScheduleActionSettings
newScte35TimeSignalScheduleActionSettings =
  Scte35TimeSignalScheduleActionSettings' :: [Scte35Descriptor] -> Scte35TimeSignalScheduleActionSettings
Scte35TimeSignalScheduleActionSettings'
    { $sel:scte35Descriptors:Scte35TimeSignalScheduleActionSettings' :: [Scte35Descriptor]
scte35Descriptors =
        [Scte35Descriptor]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The list of SCTE-35 descriptors accompanying the SCTE-35 time_signal.
scte35TimeSignalScheduleActionSettings_scte35Descriptors :: Lens.Lens' Scte35TimeSignalScheduleActionSettings [Scte35Descriptor]
scte35TimeSignalScheduleActionSettings_scte35Descriptors :: ([Scte35Descriptor] -> f [Scte35Descriptor])
-> Scte35TimeSignalScheduleActionSettings
-> f Scte35TimeSignalScheduleActionSettings
scte35TimeSignalScheduleActionSettings_scte35Descriptors = (Scte35TimeSignalScheduleActionSettings -> [Scte35Descriptor])
-> (Scte35TimeSignalScheduleActionSettings
    -> [Scte35Descriptor] -> Scte35TimeSignalScheduleActionSettings)
-> Lens
     Scte35TimeSignalScheduleActionSettings
     Scte35TimeSignalScheduleActionSettings
     [Scte35Descriptor]
     [Scte35Descriptor]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35TimeSignalScheduleActionSettings' {[Scte35Descriptor]
scte35Descriptors :: [Scte35Descriptor]
$sel:scte35Descriptors:Scte35TimeSignalScheduleActionSettings' :: Scte35TimeSignalScheduleActionSettings -> [Scte35Descriptor]
scte35Descriptors} -> [Scte35Descriptor]
scte35Descriptors) (\s :: Scte35TimeSignalScheduleActionSettings
s@Scte35TimeSignalScheduleActionSettings' {} [Scte35Descriptor]
a -> Scte35TimeSignalScheduleActionSettings
s {$sel:scte35Descriptors:Scte35TimeSignalScheduleActionSettings' :: [Scte35Descriptor]
scte35Descriptors = [Scte35Descriptor]
a} :: Scte35TimeSignalScheduleActionSettings) (([Scte35Descriptor] -> f [Scte35Descriptor])
 -> Scte35TimeSignalScheduleActionSettings
 -> f Scte35TimeSignalScheduleActionSettings)
-> (([Scte35Descriptor] -> f [Scte35Descriptor])
    -> [Scte35Descriptor] -> f [Scte35Descriptor])
-> ([Scte35Descriptor] -> f [Scte35Descriptor])
-> Scte35TimeSignalScheduleActionSettings
-> f Scte35TimeSignalScheduleActionSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Scte35Descriptor] -> f [Scte35Descriptor])
-> [Scte35Descriptor] -> f [Scte35Descriptor]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    Scte35TimeSignalScheduleActionSettings
  where
  parseJSON :: Value -> Parser Scte35TimeSignalScheduleActionSettings
parseJSON =
    String
-> (Object -> Parser Scte35TimeSignalScheduleActionSettings)
-> Value
-> Parser Scte35TimeSignalScheduleActionSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Scte35TimeSignalScheduleActionSettings"
      ( \Object
x ->
          [Scte35Descriptor] -> Scte35TimeSignalScheduleActionSettings
Scte35TimeSignalScheduleActionSettings'
            ([Scte35Descriptor] -> Scte35TimeSignalScheduleActionSettings)
-> Parser [Scte35Descriptor]
-> Parser Scte35TimeSignalScheduleActionSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe [Scte35Descriptor])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"scte35Descriptors"
                            Parser (Maybe [Scte35Descriptor])
-> [Scte35Descriptor] -> Parser [Scte35Descriptor]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Scte35Descriptor]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    Scte35TimeSignalScheduleActionSettings

instance
  Prelude.NFData
    Scte35TimeSignalScheduleActionSettings

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