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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.Scte35ArchiveAllowedFlag
import Amazonka.MediaLive.Types.Scte35DeviceRestrictions
import Amazonka.MediaLive.Types.Scte35NoRegionalBlackoutFlag
import Amazonka.MediaLive.Types.Scte35WebDeliveryAllowedFlag
import qualified Amazonka.Prelude as Prelude

-- | Corresponds to SCTE-35 delivery_not_restricted_flag parameter. To
-- declare delivery restrictions, include this element and its four
-- \"restriction\" flags. To declare that there are no restrictions, omit
-- this element.
--
-- /See:/ 'newScte35DeliveryRestrictions' smart constructor.
data Scte35DeliveryRestrictions = Scte35DeliveryRestrictions'
  { -- | Corresponds to SCTE-35 device_restrictions parameter.
    Scte35DeliveryRestrictions -> Scte35DeviceRestrictions
deviceRestrictions :: Scte35DeviceRestrictions,
    -- | Corresponds to SCTE-35 archive_allowed_flag.
    Scte35DeliveryRestrictions -> Scte35ArchiveAllowedFlag
archiveAllowedFlag :: Scte35ArchiveAllowedFlag,
    -- | Corresponds to SCTE-35 web_delivery_allowed_flag parameter.
    Scte35DeliveryRestrictions -> Scte35WebDeliveryAllowedFlag
webDeliveryAllowedFlag :: Scte35WebDeliveryAllowedFlag,
    -- | Corresponds to SCTE-35 no_regional_blackout_flag parameter.
    Scte35DeliveryRestrictions -> Scte35NoRegionalBlackoutFlag
noRegionalBlackoutFlag :: Scte35NoRegionalBlackoutFlag
  }
  deriving (Scte35DeliveryRestrictions -> Scte35DeliveryRestrictions -> Bool
(Scte35DeliveryRestrictions -> Scte35DeliveryRestrictions -> Bool)
-> (Scte35DeliveryRestrictions
    -> Scte35DeliveryRestrictions -> Bool)
-> Eq Scte35DeliveryRestrictions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scte35DeliveryRestrictions -> Scte35DeliveryRestrictions -> Bool
$c/= :: Scte35DeliveryRestrictions -> Scte35DeliveryRestrictions -> Bool
== :: Scte35DeliveryRestrictions -> Scte35DeliveryRestrictions -> Bool
$c== :: Scte35DeliveryRestrictions -> Scte35DeliveryRestrictions -> Bool
Prelude.Eq, ReadPrec [Scte35DeliveryRestrictions]
ReadPrec Scte35DeliveryRestrictions
Int -> ReadS Scte35DeliveryRestrictions
ReadS [Scte35DeliveryRestrictions]
(Int -> ReadS Scte35DeliveryRestrictions)
-> ReadS [Scte35DeliveryRestrictions]
-> ReadPrec Scte35DeliveryRestrictions
-> ReadPrec [Scte35DeliveryRestrictions]
-> Read Scte35DeliveryRestrictions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Scte35DeliveryRestrictions]
$creadListPrec :: ReadPrec [Scte35DeliveryRestrictions]
readPrec :: ReadPrec Scte35DeliveryRestrictions
$creadPrec :: ReadPrec Scte35DeliveryRestrictions
readList :: ReadS [Scte35DeliveryRestrictions]
$creadList :: ReadS [Scte35DeliveryRestrictions]
readsPrec :: Int -> ReadS Scte35DeliveryRestrictions
$creadsPrec :: Int -> ReadS Scte35DeliveryRestrictions
Prelude.Read, Int -> Scte35DeliveryRestrictions -> ShowS
[Scte35DeliveryRestrictions] -> ShowS
Scte35DeliveryRestrictions -> String
(Int -> Scte35DeliveryRestrictions -> ShowS)
-> (Scte35DeliveryRestrictions -> String)
-> ([Scte35DeliveryRestrictions] -> ShowS)
-> Show Scte35DeliveryRestrictions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scte35DeliveryRestrictions] -> ShowS
$cshowList :: [Scte35DeliveryRestrictions] -> ShowS
show :: Scte35DeliveryRestrictions -> String
$cshow :: Scte35DeliveryRestrictions -> String
showsPrec :: Int -> Scte35DeliveryRestrictions -> ShowS
$cshowsPrec :: Int -> Scte35DeliveryRestrictions -> ShowS
Prelude.Show, (forall x.
 Scte35DeliveryRestrictions -> Rep Scte35DeliveryRestrictions x)
-> (forall x.
    Rep Scte35DeliveryRestrictions x -> Scte35DeliveryRestrictions)
-> Generic Scte35DeliveryRestrictions
forall x.
Rep Scte35DeliveryRestrictions x -> Scte35DeliveryRestrictions
forall x.
Scte35DeliveryRestrictions -> Rep Scte35DeliveryRestrictions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep Scte35DeliveryRestrictions x -> Scte35DeliveryRestrictions
$cfrom :: forall x.
Scte35DeliveryRestrictions -> Rep Scte35DeliveryRestrictions x
Prelude.Generic)

-- |
-- Create a value of 'Scte35DeliveryRestrictions' 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:
--
-- 'deviceRestrictions', 'scte35DeliveryRestrictions_deviceRestrictions' - Corresponds to SCTE-35 device_restrictions parameter.
--
-- 'archiveAllowedFlag', 'scte35DeliveryRestrictions_archiveAllowedFlag' - Corresponds to SCTE-35 archive_allowed_flag.
--
-- 'webDeliveryAllowedFlag', 'scte35DeliveryRestrictions_webDeliveryAllowedFlag' - Corresponds to SCTE-35 web_delivery_allowed_flag parameter.
--
-- 'noRegionalBlackoutFlag', 'scte35DeliveryRestrictions_noRegionalBlackoutFlag' - Corresponds to SCTE-35 no_regional_blackout_flag parameter.
newScte35DeliveryRestrictions ::
  -- | 'deviceRestrictions'
  Scte35DeviceRestrictions ->
  -- | 'archiveAllowedFlag'
  Scte35ArchiveAllowedFlag ->
  -- | 'webDeliveryAllowedFlag'
  Scte35WebDeliveryAllowedFlag ->
  -- | 'noRegionalBlackoutFlag'
  Scte35NoRegionalBlackoutFlag ->
  Scte35DeliveryRestrictions
newScte35DeliveryRestrictions :: Scte35DeviceRestrictions
-> Scte35ArchiveAllowedFlag
-> Scte35WebDeliveryAllowedFlag
-> Scte35NoRegionalBlackoutFlag
-> Scte35DeliveryRestrictions
newScte35DeliveryRestrictions
  Scte35DeviceRestrictions
pDeviceRestrictions_
  Scte35ArchiveAllowedFlag
pArchiveAllowedFlag_
  Scte35WebDeliveryAllowedFlag
pWebDeliveryAllowedFlag_
  Scte35NoRegionalBlackoutFlag
pNoRegionalBlackoutFlag_ =
    Scte35DeliveryRestrictions' :: Scte35DeviceRestrictions
-> Scte35ArchiveAllowedFlag
-> Scte35WebDeliveryAllowedFlag
-> Scte35NoRegionalBlackoutFlag
-> Scte35DeliveryRestrictions
Scte35DeliveryRestrictions'
      { $sel:deviceRestrictions:Scte35DeliveryRestrictions' :: Scte35DeviceRestrictions
deviceRestrictions =
          Scte35DeviceRestrictions
pDeviceRestrictions_,
        $sel:archiveAllowedFlag:Scte35DeliveryRestrictions' :: Scte35ArchiveAllowedFlag
archiveAllowedFlag = Scte35ArchiveAllowedFlag
pArchiveAllowedFlag_,
        $sel:webDeliveryAllowedFlag:Scte35DeliveryRestrictions' :: Scte35WebDeliveryAllowedFlag
webDeliveryAllowedFlag =
          Scte35WebDeliveryAllowedFlag
pWebDeliveryAllowedFlag_,
        $sel:noRegionalBlackoutFlag:Scte35DeliveryRestrictions' :: Scte35NoRegionalBlackoutFlag
noRegionalBlackoutFlag =
          Scte35NoRegionalBlackoutFlag
pNoRegionalBlackoutFlag_
      }

-- | Corresponds to SCTE-35 device_restrictions parameter.
scte35DeliveryRestrictions_deviceRestrictions :: Lens.Lens' Scte35DeliveryRestrictions Scte35DeviceRestrictions
scte35DeliveryRestrictions_deviceRestrictions :: (Scte35DeviceRestrictions -> f Scte35DeviceRestrictions)
-> Scte35DeliveryRestrictions -> f Scte35DeliveryRestrictions
scte35DeliveryRestrictions_deviceRestrictions = (Scte35DeliveryRestrictions -> Scte35DeviceRestrictions)
-> (Scte35DeliveryRestrictions
    -> Scte35DeviceRestrictions -> Scte35DeliveryRestrictions)
-> Lens
     Scte35DeliveryRestrictions
     Scte35DeliveryRestrictions
     Scte35DeviceRestrictions
     Scte35DeviceRestrictions
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35DeliveryRestrictions' {Scte35DeviceRestrictions
deviceRestrictions :: Scte35DeviceRestrictions
$sel:deviceRestrictions:Scte35DeliveryRestrictions' :: Scte35DeliveryRestrictions -> Scte35DeviceRestrictions
deviceRestrictions} -> Scte35DeviceRestrictions
deviceRestrictions) (\s :: Scte35DeliveryRestrictions
s@Scte35DeliveryRestrictions' {} Scte35DeviceRestrictions
a -> Scte35DeliveryRestrictions
s {$sel:deviceRestrictions:Scte35DeliveryRestrictions' :: Scte35DeviceRestrictions
deviceRestrictions = Scte35DeviceRestrictions
a} :: Scte35DeliveryRestrictions)

-- | Corresponds to SCTE-35 archive_allowed_flag.
scte35DeliveryRestrictions_archiveAllowedFlag :: Lens.Lens' Scte35DeliveryRestrictions Scte35ArchiveAllowedFlag
scte35DeliveryRestrictions_archiveAllowedFlag :: (Scte35ArchiveAllowedFlag -> f Scte35ArchiveAllowedFlag)
-> Scte35DeliveryRestrictions -> f Scte35DeliveryRestrictions
scte35DeliveryRestrictions_archiveAllowedFlag = (Scte35DeliveryRestrictions -> Scte35ArchiveAllowedFlag)
-> (Scte35DeliveryRestrictions
    -> Scte35ArchiveAllowedFlag -> Scte35DeliveryRestrictions)
-> Lens
     Scte35DeliveryRestrictions
     Scte35DeliveryRestrictions
     Scte35ArchiveAllowedFlag
     Scte35ArchiveAllowedFlag
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35DeliveryRestrictions' {Scte35ArchiveAllowedFlag
archiveAllowedFlag :: Scte35ArchiveAllowedFlag
$sel:archiveAllowedFlag:Scte35DeliveryRestrictions' :: Scte35DeliveryRestrictions -> Scte35ArchiveAllowedFlag
archiveAllowedFlag} -> Scte35ArchiveAllowedFlag
archiveAllowedFlag) (\s :: Scte35DeliveryRestrictions
s@Scte35DeliveryRestrictions' {} Scte35ArchiveAllowedFlag
a -> Scte35DeliveryRestrictions
s {$sel:archiveAllowedFlag:Scte35DeliveryRestrictions' :: Scte35ArchiveAllowedFlag
archiveAllowedFlag = Scte35ArchiveAllowedFlag
a} :: Scte35DeliveryRestrictions)

-- | Corresponds to SCTE-35 web_delivery_allowed_flag parameter.
scte35DeliveryRestrictions_webDeliveryAllowedFlag :: Lens.Lens' Scte35DeliveryRestrictions Scte35WebDeliveryAllowedFlag
scte35DeliveryRestrictions_webDeliveryAllowedFlag :: (Scte35WebDeliveryAllowedFlag -> f Scte35WebDeliveryAllowedFlag)
-> Scte35DeliveryRestrictions -> f Scte35DeliveryRestrictions
scte35DeliveryRestrictions_webDeliveryAllowedFlag = (Scte35DeliveryRestrictions -> Scte35WebDeliveryAllowedFlag)
-> (Scte35DeliveryRestrictions
    -> Scte35WebDeliveryAllowedFlag -> Scte35DeliveryRestrictions)
-> Lens
     Scte35DeliveryRestrictions
     Scte35DeliveryRestrictions
     Scte35WebDeliveryAllowedFlag
     Scte35WebDeliveryAllowedFlag
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35DeliveryRestrictions' {Scte35WebDeliveryAllowedFlag
webDeliveryAllowedFlag :: Scte35WebDeliveryAllowedFlag
$sel:webDeliveryAllowedFlag:Scte35DeliveryRestrictions' :: Scte35DeliveryRestrictions -> Scte35WebDeliveryAllowedFlag
webDeliveryAllowedFlag} -> Scte35WebDeliveryAllowedFlag
webDeliveryAllowedFlag) (\s :: Scte35DeliveryRestrictions
s@Scte35DeliveryRestrictions' {} Scte35WebDeliveryAllowedFlag
a -> Scte35DeliveryRestrictions
s {$sel:webDeliveryAllowedFlag:Scte35DeliveryRestrictions' :: Scte35WebDeliveryAllowedFlag
webDeliveryAllowedFlag = Scte35WebDeliveryAllowedFlag
a} :: Scte35DeliveryRestrictions)

-- | Corresponds to SCTE-35 no_regional_blackout_flag parameter.
scte35DeliveryRestrictions_noRegionalBlackoutFlag :: Lens.Lens' Scte35DeliveryRestrictions Scte35NoRegionalBlackoutFlag
scte35DeliveryRestrictions_noRegionalBlackoutFlag :: (Scte35NoRegionalBlackoutFlag -> f Scte35NoRegionalBlackoutFlag)
-> Scte35DeliveryRestrictions -> f Scte35DeliveryRestrictions
scte35DeliveryRestrictions_noRegionalBlackoutFlag = (Scte35DeliveryRestrictions -> Scte35NoRegionalBlackoutFlag)
-> (Scte35DeliveryRestrictions
    -> Scte35NoRegionalBlackoutFlag -> Scte35DeliveryRestrictions)
-> Lens
     Scte35DeliveryRestrictions
     Scte35DeliveryRestrictions
     Scte35NoRegionalBlackoutFlag
     Scte35NoRegionalBlackoutFlag
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scte35DeliveryRestrictions' {Scte35NoRegionalBlackoutFlag
noRegionalBlackoutFlag :: Scte35NoRegionalBlackoutFlag
$sel:noRegionalBlackoutFlag:Scte35DeliveryRestrictions' :: Scte35DeliveryRestrictions -> Scte35NoRegionalBlackoutFlag
noRegionalBlackoutFlag} -> Scte35NoRegionalBlackoutFlag
noRegionalBlackoutFlag) (\s :: Scte35DeliveryRestrictions
s@Scte35DeliveryRestrictions' {} Scte35NoRegionalBlackoutFlag
a -> Scte35DeliveryRestrictions
s {$sel:noRegionalBlackoutFlag:Scte35DeliveryRestrictions' :: Scte35NoRegionalBlackoutFlag
noRegionalBlackoutFlag = Scte35NoRegionalBlackoutFlag
a} :: Scte35DeliveryRestrictions)

instance Core.FromJSON Scte35DeliveryRestrictions where
  parseJSON :: Value -> Parser Scte35DeliveryRestrictions
parseJSON =
    String
-> (Object -> Parser Scte35DeliveryRestrictions)
-> Value
-> Parser Scte35DeliveryRestrictions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Scte35DeliveryRestrictions"
      ( \Object
x ->
          Scte35DeviceRestrictions
-> Scte35ArchiveAllowedFlag
-> Scte35WebDeliveryAllowedFlag
-> Scte35NoRegionalBlackoutFlag
-> Scte35DeliveryRestrictions
Scte35DeliveryRestrictions'
            (Scte35DeviceRestrictions
 -> Scte35ArchiveAllowedFlag
 -> Scte35WebDeliveryAllowedFlag
 -> Scte35NoRegionalBlackoutFlag
 -> Scte35DeliveryRestrictions)
-> Parser Scte35DeviceRestrictions
-> Parser
     (Scte35ArchiveAllowedFlag
      -> Scte35WebDeliveryAllowedFlag
      -> Scte35NoRegionalBlackoutFlag
      -> Scte35DeliveryRestrictions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Scte35DeviceRestrictions
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"deviceRestrictions")
            Parser
  (Scte35ArchiveAllowedFlag
   -> Scte35WebDeliveryAllowedFlag
   -> Scte35NoRegionalBlackoutFlag
   -> Scte35DeliveryRestrictions)
-> Parser Scte35ArchiveAllowedFlag
-> Parser
     (Scte35WebDeliveryAllowedFlag
      -> Scte35NoRegionalBlackoutFlag -> Scte35DeliveryRestrictions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Scte35ArchiveAllowedFlag
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"archiveAllowedFlag")
            Parser
  (Scte35WebDeliveryAllowedFlag
   -> Scte35NoRegionalBlackoutFlag -> Scte35DeliveryRestrictions)
-> Parser Scte35WebDeliveryAllowedFlag
-> Parser
     (Scte35NoRegionalBlackoutFlag -> Scte35DeliveryRestrictions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Scte35WebDeliveryAllowedFlag
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"webDeliveryAllowedFlag")
            Parser (Scte35NoRegionalBlackoutFlag -> Scte35DeliveryRestrictions)
-> Parser Scte35NoRegionalBlackoutFlag
-> Parser Scte35DeliveryRestrictions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Scte35NoRegionalBlackoutFlag
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"noRegionalBlackoutFlag")
      )

instance Prelude.Hashable Scte35DeliveryRestrictions

instance Prelude.NFData Scte35DeliveryRestrictions

instance Core.ToJSON Scte35DeliveryRestrictions where
  toJSON :: Scte35DeliveryRestrictions -> Value
toJSON Scte35DeliveryRestrictions' {Scte35ArchiveAllowedFlag
Scte35DeviceRestrictions
Scte35NoRegionalBlackoutFlag
Scte35WebDeliveryAllowedFlag
noRegionalBlackoutFlag :: Scte35NoRegionalBlackoutFlag
webDeliveryAllowedFlag :: Scte35WebDeliveryAllowedFlag
archiveAllowedFlag :: Scte35ArchiveAllowedFlag
deviceRestrictions :: Scte35DeviceRestrictions
$sel:noRegionalBlackoutFlag:Scte35DeliveryRestrictions' :: Scte35DeliveryRestrictions -> Scte35NoRegionalBlackoutFlag
$sel:webDeliveryAllowedFlag:Scte35DeliveryRestrictions' :: Scte35DeliveryRestrictions -> Scte35WebDeliveryAllowedFlag
$sel:archiveAllowedFlag:Scte35DeliveryRestrictions' :: Scte35DeliveryRestrictions -> Scte35ArchiveAllowedFlag
$sel:deviceRestrictions:Scte35DeliveryRestrictions' :: Scte35DeliveryRestrictions -> Scte35DeviceRestrictions
..} =
    [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
"deviceRestrictions" Text -> Scte35DeviceRestrictions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Scte35DeviceRestrictions
deviceRestrictions),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"archiveAllowedFlag" Text -> Scte35ArchiveAllowedFlag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Scte35ArchiveAllowedFlag
archiveAllowedFlag),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"webDeliveryAllowedFlag"
                  Text -> Scte35WebDeliveryAllowedFlag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Scte35WebDeliveryAllowedFlag
webDeliveryAllowedFlag
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"noRegionalBlackoutFlag"
                  Text -> Scte35NoRegionalBlackoutFlag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Scte35NoRegionalBlackoutFlag
noRegionalBlackoutFlag
              )
          ]
      )