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

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

-- | Feature Activations
--
-- /See:/ 'newFeatureActivations' smart constructor.
data FeatureActivations = FeatureActivations'
  { -- | Enables the Input Prepare feature. You can create Input Prepare actions
    -- in the schedule only if this feature is enabled. If you disable the
    -- feature on an existing schedule, make sure that you first delete all
    -- input prepare actions from the schedule.
    FeatureActivations
-> Maybe FeatureActivationsInputPrepareScheduleActions
inputPrepareScheduleActions :: Prelude.Maybe FeatureActivationsInputPrepareScheduleActions
  }
  deriving (FeatureActivations -> FeatureActivations -> Bool
(FeatureActivations -> FeatureActivations -> Bool)
-> (FeatureActivations -> FeatureActivations -> Bool)
-> Eq FeatureActivations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FeatureActivations -> FeatureActivations -> Bool
$c/= :: FeatureActivations -> FeatureActivations -> Bool
== :: FeatureActivations -> FeatureActivations -> Bool
$c== :: FeatureActivations -> FeatureActivations -> Bool
Prelude.Eq, ReadPrec [FeatureActivations]
ReadPrec FeatureActivations
Int -> ReadS FeatureActivations
ReadS [FeatureActivations]
(Int -> ReadS FeatureActivations)
-> ReadS [FeatureActivations]
-> ReadPrec FeatureActivations
-> ReadPrec [FeatureActivations]
-> Read FeatureActivations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FeatureActivations]
$creadListPrec :: ReadPrec [FeatureActivations]
readPrec :: ReadPrec FeatureActivations
$creadPrec :: ReadPrec FeatureActivations
readList :: ReadS [FeatureActivations]
$creadList :: ReadS [FeatureActivations]
readsPrec :: Int -> ReadS FeatureActivations
$creadsPrec :: Int -> ReadS FeatureActivations
Prelude.Read, Int -> FeatureActivations -> ShowS
[FeatureActivations] -> ShowS
FeatureActivations -> String
(Int -> FeatureActivations -> ShowS)
-> (FeatureActivations -> String)
-> ([FeatureActivations] -> ShowS)
-> Show FeatureActivations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FeatureActivations] -> ShowS
$cshowList :: [FeatureActivations] -> ShowS
show :: FeatureActivations -> String
$cshow :: FeatureActivations -> String
showsPrec :: Int -> FeatureActivations -> ShowS
$cshowsPrec :: Int -> FeatureActivations -> ShowS
Prelude.Show, (forall x. FeatureActivations -> Rep FeatureActivations x)
-> (forall x. Rep FeatureActivations x -> FeatureActivations)
-> Generic FeatureActivations
forall x. Rep FeatureActivations x -> FeatureActivations
forall x. FeatureActivations -> Rep FeatureActivations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FeatureActivations x -> FeatureActivations
$cfrom :: forall x. FeatureActivations -> Rep FeatureActivations x
Prelude.Generic)

-- |
-- Create a value of 'FeatureActivations' 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:
--
-- 'inputPrepareScheduleActions', 'featureActivations_inputPrepareScheduleActions' - Enables the Input Prepare feature. You can create Input Prepare actions
-- in the schedule only if this feature is enabled. If you disable the
-- feature on an existing schedule, make sure that you first delete all
-- input prepare actions from the schedule.
newFeatureActivations ::
  FeatureActivations
newFeatureActivations :: FeatureActivations
newFeatureActivations =
  FeatureActivations' :: Maybe FeatureActivationsInputPrepareScheduleActions
-> FeatureActivations
FeatureActivations'
    { $sel:inputPrepareScheduleActions:FeatureActivations' :: Maybe FeatureActivationsInputPrepareScheduleActions
inputPrepareScheduleActions =
        Maybe FeatureActivationsInputPrepareScheduleActions
forall a. Maybe a
Prelude.Nothing
    }

-- | Enables the Input Prepare feature. You can create Input Prepare actions
-- in the schedule only if this feature is enabled. If you disable the
-- feature on an existing schedule, make sure that you first delete all
-- input prepare actions from the schedule.
featureActivations_inputPrepareScheduleActions :: Lens.Lens' FeatureActivations (Prelude.Maybe FeatureActivationsInputPrepareScheduleActions)
featureActivations_inputPrepareScheduleActions :: (Maybe FeatureActivationsInputPrepareScheduleActions
 -> f (Maybe FeatureActivationsInputPrepareScheduleActions))
-> FeatureActivations -> f FeatureActivations
featureActivations_inputPrepareScheduleActions = (FeatureActivations
 -> Maybe FeatureActivationsInputPrepareScheduleActions)
-> (FeatureActivations
    -> Maybe FeatureActivationsInputPrepareScheduleActions
    -> FeatureActivations)
-> Lens
     FeatureActivations
     FeatureActivations
     (Maybe FeatureActivationsInputPrepareScheduleActions)
     (Maybe FeatureActivationsInputPrepareScheduleActions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FeatureActivations' {Maybe FeatureActivationsInputPrepareScheduleActions
inputPrepareScheduleActions :: Maybe FeatureActivationsInputPrepareScheduleActions
$sel:inputPrepareScheduleActions:FeatureActivations' :: FeatureActivations
-> Maybe FeatureActivationsInputPrepareScheduleActions
inputPrepareScheduleActions} -> Maybe FeatureActivationsInputPrepareScheduleActions
inputPrepareScheduleActions) (\s :: FeatureActivations
s@FeatureActivations' {} Maybe FeatureActivationsInputPrepareScheduleActions
a -> FeatureActivations
s {$sel:inputPrepareScheduleActions:FeatureActivations' :: Maybe FeatureActivationsInputPrepareScheduleActions
inputPrepareScheduleActions = Maybe FeatureActivationsInputPrepareScheduleActions
a} :: FeatureActivations)

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

instance Prelude.Hashable FeatureActivations

instance Prelude.NFData FeatureActivations

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