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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.InputLocation
import Amazonka.MediaLive.Types.InputLossImageType
import qualified Amazonka.Prelude as Prelude

-- | Input Loss Behavior
--
-- /See:/ 'newInputLossBehavior' smart constructor.
data InputLossBehavior = InputLossBehavior'
  { -- | When input loss image type is \"color\" this field specifies the color
    -- to use. Value: 6 hex characters representing the values of RGB.
    InputLossBehavior -> Maybe Text
inputLossImageColor :: Prelude.Maybe Prelude.Text,
    -- | Documentation update needed
    InputLossBehavior -> Maybe Natural
blackFrameMsec :: Prelude.Maybe Prelude.Natural,
    -- | Documentation update needed
    InputLossBehavior -> Maybe Natural
repeatFrameMsec :: Prelude.Maybe Prelude.Natural,
    -- | Indicates whether to substitute a solid color or a slate into the output
    -- after input loss exceeds blackFrameMsec.
    InputLossBehavior -> Maybe InputLossImageType
inputLossImageType :: Prelude.Maybe InputLossImageType,
    -- | When input loss image type is \"slate\" these fields specify the
    -- parameters for accessing the slate.
    InputLossBehavior -> Maybe InputLocation
inputLossImageSlate :: Prelude.Maybe InputLocation
  }
  deriving (InputLossBehavior -> InputLossBehavior -> Bool
(InputLossBehavior -> InputLossBehavior -> Bool)
-> (InputLossBehavior -> InputLossBehavior -> Bool)
-> Eq InputLossBehavior
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputLossBehavior -> InputLossBehavior -> Bool
$c/= :: InputLossBehavior -> InputLossBehavior -> Bool
== :: InputLossBehavior -> InputLossBehavior -> Bool
$c== :: InputLossBehavior -> InputLossBehavior -> Bool
Prelude.Eq, ReadPrec [InputLossBehavior]
ReadPrec InputLossBehavior
Int -> ReadS InputLossBehavior
ReadS [InputLossBehavior]
(Int -> ReadS InputLossBehavior)
-> ReadS [InputLossBehavior]
-> ReadPrec InputLossBehavior
-> ReadPrec [InputLossBehavior]
-> Read InputLossBehavior
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputLossBehavior]
$creadListPrec :: ReadPrec [InputLossBehavior]
readPrec :: ReadPrec InputLossBehavior
$creadPrec :: ReadPrec InputLossBehavior
readList :: ReadS [InputLossBehavior]
$creadList :: ReadS [InputLossBehavior]
readsPrec :: Int -> ReadS InputLossBehavior
$creadsPrec :: Int -> ReadS InputLossBehavior
Prelude.Read, Int -> InputLossBehavior -> ShowS
[InputLossBehavior] -> ShowS
InputLossBehavior -> String
(Int -> InputLossBehavior -> ShowS)
-> (InputLossBehavior -> String)
-> ([InputLossBehavior] -> ShowS)
-> Show InputLossBehavior
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputLossBehavior] -> ShowS
$cshowList :: [InputLossBehavior] -> ShowS
show :: InputLossBehavior -> String
$cshow :: InputLossBehavior -> String
showsPrec :: Int -> InputLossBehavior -> ShowS
$cshowsPrec :: Int -> InputLossBehavior -> ShowS
Prelude.Show, (forall x. InputLossBehavior -> Rep InputLossBehavior x)
-> (forall x. Rep InputLossBehavior x -> InputLossBehavior)
-> Generic InputLossBehavior
forall x. Rep InputLossBehavior x -> InputLossBehavior
forall x. InputLossBehavior -> Rep InputLossBehavior x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputLossBehavior x -> InputLossBehavior
$cfrom :: forall x. InputLossBehavior -> Rep InputLossBehavior x
Prelude.Generic)

-- |
-- Create a value of 'InputLossBehavior' 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:
--
-- 'inputLossImageColor', 'inputLossBehavior_inputLossImageColor' - When input loss image type is \"color\" this field specifies the color
-- to use. Value: 6 hex characters representing the values of RGB.
--
-- 'blackFrameMsec', 'inputLossBehavior_blackFrameMsec' - Documentation update needed
--
-- 'repeatFrameMsec', 'inputLossBehavior_repeatFrameMsec' - Documentation update needed
--
-- 'inputLossImageType', 'inputLossBehavior_inputLossImageType' - Indicates whether to substitute a solid color or a slate into the output
-- after input loss exceeds blackFrameMsec.
--
-- 'inputLossImageSlate', 'inputLossBehavior_inputLossImageSlate' - When input loss image type is \"slate\" these fields specify the
-- parameters for accessing the slate.
newInputLossBehavior ::
  InputLossBehavior
newInputLossBehavior :: InputLossBehavior
newInputLossBehavior =
  InputLossBehavior' :: Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe InputLossImageType
-> Maybe InputLocation
-> InputLossBehavior
InputLossBehavior'
    { $sel:inputLossImageColor:InputLossBehavior' :: Maybe Text
inputLossImageColor =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:blackFrameMsec:InputLossBehavior' :: Maybe Natural
blackFrameMsec = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:repeatFrameMsec:InputLossBehavior' :: Maybe Natural
repeatFrameMsec = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:inputLossImageType:InputLossBehavior' :: Maybe InputLossImageType
inputLossImageType = Maybe InputLossImageType
forall a. Maybe a
Prelude.Nothing,
      $sel:inputLossImageSlate:InputLossBehavior' :: Maybe InputLocation
inputLossImageSlate = Maybe InputLocation
forall a. Maybe a
Prelude.Nothing
    }

-- | When input loss image type is \"color\" this field specifies the color
-- to use. Value: 6 hex characters representing the values of RGB.
inputLossBehavior_inputLossImageColor :: Lens.Lens' InputLossBehavior (Prelude.Maybe Prelude.Text)
inputLossBehavior_inputLossImageColor :: (Maybe Text -> f (Maybe Text))
-> InputLossBehavior -> f InputLossBehavior
inputLossBehavior_inputLossImageColor = (InputLossBehavior -> Maybe Text)
-> (InputLossBehavior -> Maybe Text -> InputLossBehavior)
-> Lens
     InputLossBehavior InputLossBehavior (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLossBehavior' {Maybe Text
inputLossImageColor :: Maybe Text
$sel:inputLossImageColor:InputLossBehavior' :: InputLossBehavior -> Maybe Text
inputLossImageColor} -> Maybe Text
inputLossImageColor) (\s :: InputLossBehavior
s@InputLossBehavior' {} Maybe Text
a -> InputLossBehavior
s {$sel:inputLossImageColor:InputLossBehavior' :: Maybe Text
inputLossImageColor = Maybe Text
a} :: InputLossBehavior)

-- | Documentation update needed
inputLossBehavior_blackFrameMsec :: Lens.Lens' InputLossBehavior (Prelude.Maybe Prelude.Natural)
inputLossBehavior_blackFrameMsec :: (Maybe Natural -> f (Maybe Natural))
-> InputLossBehavior -> f InputLossBehavior
inputLossBehavior_blackFrameMsec = (InputLossBehavior -> Maybe Natural)
-> (InputLossBehavior -> Maybe Natural -> InputLossBehavior)
-> Lens
     InputLossBehavior InputLossBehavior (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLossBehavior' {Maybe Natural
blackFrameMsec :: Maybe Natural
$sel:blackFrameMsec:InputLossBehavior' :: InputLossBehavior -> Maybe Natural
blackFrameMsec} -> Maybe Natural
blackFrameMsec) (\s :: InputLossBehavior
s@InputLossBehavior' {} Maybe Natural
a -> InputLossBehavior
s {$sel:blackFrameMsec:InputLossBehavior' :: Maybe Natural
blackFrameMsec = Maybe Natural
a} :: InputLossBehavior)

-- | Documentation update needed
inputLossBehavior_repeatFrameMsec :: Lens.Lens' InputLossBehavior (Prelude.Maybe Prelude.Natural)
inputLossBehavior_repeatFrameMsec :: (Maybe Natural -> f (Maybe Natural))
-> InputLossBehavior -> f InputLossBehavior
inputLossBehavior_repeatFrameMsec = (InputLossBehavior -> Maybe Natural)
-> (InputLossBehavior -> Maybe Natural -> InputLossBehavior)
-> Lens
     InputLossBehavior InputLossBehavior (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLossBehavior' {Maybe Natural
repeatFrameMsec :: Maybe Natural
$sel:repeatFrameMsec:InputLossBehavior' :: InputLossBehavior -> Maybe Natural
repeatFrameMsec} -> Maybe Natural
repeatFrameMsec) (\s :: InputLossBehavior
s@InputLossBehavior' {} Maybe Natural
a -> InputLossBehavior
s {$sel:repeatFrameMsec:InputLossBehavior' :: Maybe Natural
repeatFrameMsec = Maybe Natural
a} :: InputLossBehavior)

-- | Indicates whether to substitute a solid color or a slate into the output
-- after input loss exceeds blackFrameMsec.
inputLossBehavior_inputLossImageType :: Lens.Lens' InputLossBehavior (Prelude.Maybe InputLossImageType)
inputLossBehavior_inputLossImageType :: (Maybe InputLossImageType -> f (Maybe InputLossImageType))
-> InputLossBehavior -> f InputLossBehavior
inputLossBehavior_inputLossImageType = (InputLossBehavior -> Maybe InputLossImageType)
-> (InputLossBehavior
    -> Maybe InputLossImageType -> InputLossBehavior)
-> Lens
     InputLossBehavior
     InputLossBehavior
     (Maybe InputLossImageType)
     (Maybe InputLossImageType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLossBehavior' {Maybe InputLossImageType
inputLossImageType :: Maybe InputLossImageType
$sel:inputLossImageType:InputLossBehavior' :: InputLossBehavior -> Maybe InputLossImageType
inputLossImageType} -> Maybe InputLossImageType
inputLossImageType) (\s :: InputLossBehavior
s@InputLossBehavior' {} Maybe InputLossImageType
a -> InputLossBehavior
s {$sel:inputLossImageType:InputLossBehavior' :: Maybe InputLossImageType
inputLossImageType = Maybe InputLossImageType
a} :: InputLossBehavior)

-- | When input loss image type is \"slate\" these fields specify the
-- parameters for accessing the slate.
inputLossBehavior_inputLossImageSlate :: Lens.Lens' InputLossBehavior (Prelude.Maybe InputLocation)
inputLossBehavior_inputLossImageSlate :: (Maybe InputLocation -> f (Maybe InputLocation))
-> InputLossBehavior -> f InputLossBehavior
inputLossBehavior_inputLossImageSlate = (InputLossBehavior -> Maybe InputLocation)
-> (InputLossBehavior -> Maybe InputLocation -> InputLossBehavior)
-> Lens
     InputLossBehavior
     InputLossBehavior
     (Maybe InputLocation)
     (Maybe InputLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLossBehavior' {Maybe InputLocation
inputLossImageSlate :: Maybe InputLocation
$sel:inputLossImageSlate:InputLossBehavior' :: InputLossBehavior -> Maybe InputLocation
inputLossImageSlate} -> Maybe InputLocation
inputLossImageSlate) (\s :: InputLossBehavior
s@InputLossBehavior' {} Maybe InputLocation
a -> InputLossBehavior
s {$sel:inputLossImageSlate:InputLossBehavior' :: Maybe InputLocation
inputLossImageSlate = Maybe InputLocation
a} :: InputLossBehavior)

instance Core.FromJSON InputLossBehavior where
  parseJSON :: Value -> Parser InputLossBehavior
parseJSON =
    String
-> (Object -> Parser InputLossBehavior)
-> Value
-> Parser InputLossBehavior
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InputLossBehavior"
      ( \Object
x ->
          Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe InputLossImageType
-> Maybe InputLocation
-> InputLossBehavior
InputLossBehavior'
            (Maybe Text
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe InputLossImageType
 -> Maybe InputLocation
 -> InputLossBehavior)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe Natural
      -> Maybe InputLossImageType
      -> Maybe InputLocation
      -> InputLossBehavior)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputLossImageColor")
            Parser
  (Maybe Natural
   -> Maybe Natural
   -> Maybe InputLossImageType
   -> Maybe InputLocation
   -> InputLossBehavior)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Maybe InputLossImageType
      -> Maybe InputLocation
      -> InputLossBehavior)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"blackFrameMsec")
            Parser
  (Maybe Natural
   -> Maybe InputLossImageType
   -> Maybe InputLocation
   -> InputLossBehavior)
-> Parser (Maybe Natural)
-> Parser
     (Maybe InputLossImageType
      -> Maybe InputLocation -> InputLossBehavior)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"repeatFrameMsec")
            Parser
  (Maybe InputLossImageType
   -> Maybe InputLocation -> InputLossBehavior)
-> Parser (Maybe InputLossImageType)
-> Parser (Maybe InputLocation -> InputLossBehavior)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InputLossImageType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputLossImageType")
            Parser (Maybe InputLocation -> InputLossBehavior)
-> Parser (Maybe InputLocation) -> Parser InputLossBehavior
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InputLocation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputLossImageSlate")
      )

instance Prelude.Hashable InputLossBehavior

instance Prelude.NFData InputLossBehavior

instance Core.ToJSON InputLossBehavior where
  toJSON :: InputLossBehavior -> Value
toJSON InputLossBehavior' {Maybe Natural
Maybe Text
Maybe InputLocation
Maybe InputLossImageType
inputLossImageSlate :: Maybe InputLocation
inputLossImageType :: Maybe InputLossImageType
repeatFrameMsec :: Maybe Natural
blackFrameMsec :: Maybe Natural
inputLossImageColor :: Maybe Text
$sel:inputLossImageSlate:InputLossBehavior' :: InputLossBehavior -> Maybe InputLocation
$sel:inputLossImageType:InputLossBehavior' :: InputLossBehavior -> Maybe InputLossImageType
$sel:repeatFrameMsec:InputLossBehavior' :: InputLossBehavior -> Maybe Natural
$sel:blackFrameMsec:InputLossBehavior' :: InputLossBehavior -> Maybe Natural
$sel:inputLossImageColor:InputLossBehavior' :: InputLossBehavior -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"inputLossImageColor" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
inputLossImageColor,
            (Text
"blackFrameMsec" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
blackFrameMsec,
            (Text
"repeatFrameMsec" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
repeatFrameMsec,
            (Text
"inputLossImageType" Text -> InputLossImageType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InputLossImageType -> Pair)
-> Maybe InputLossImageType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputLossImageType
inputLossImageType,
            (Text
"inputLossImageSlate" Text -> InputLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InputLocation -> Pair) -> Maybe InputLocation -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputLocation
inputLossImageSlate
          ]
      )