{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.InputLossBehavior where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | Documentation update needed
    InputLossBehavior -> Maybe Natural
blackFrameMsec :: Prelude.Maybe Prelude.Natural,
    -- | 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,
    -- | When input loss image type is \"slate\" these fields specify the
    -- parameters for accessing the slate.
    InputLossBehavior -> Maybe InputLocation
inputLossImageSlate :: Prelude.Maybe InputLocation,
    -- | 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,
    -- | Documentation update needed
    InputLossBehavior -> Maybe Natural
repeatFrameMsec :: Prelude.Maybe Prelude.Natural
  }
  deriving (InputLossBehavior -> InputLossBehavior -> Bool
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]
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
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. 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:
--
-- 'blackFrameMsec', 'inputLossBehavior_blackFrameMsec' - Documentation update needed
--
-- '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.
--
-- 'inputLossImageSlate', 'inputLossBehavior_inputLossImageSlate' - When input loss image type is \"slate\" these fields specify the
-- parameters for accessing the slate.
--
-- 'inputLossImageType', 'inputLossBehavior_inputLossImageType' - Indicates whether to substitute a solid color or a slate into the output
-- after input loss exceeds blackFrameMsec.
--
-- 'repeatFrameMsec', 'inputLossBehavior_repeatFrameMsec' - Documentation update needed
newInputLossBehavior ::
  InputLossBehavior
newInputLossBehavior :: InputLossBehavior
newInputLossBehavior =
  InputLossBehavior'
    { $sel:blackFrameMsec:InputLossBehavior' :: Maybe Natural
blackFrameMsec =
        forall a. Maybe a
Prelude.Nothing,
      $sel:inputLossImageColor:InputLossBehavior' :: Maybe Text
inputLossImageColor = forall a. Maybe a
Prelude.Nothing,
      $sel:inputLossImageSlate:InputLossBehavior' :: Maybe InputLocation
inputLossImageSlate = forall a. Maybe a
Prelude.Nothing,
      $sel:inputLossImageType:InputLossBehavior' :: Maybe InputLossImageType
inputLossImageType = forall a. Maybe a
Prelude.Nothing,
      $sel:repeatFrameMsec:InputLossBehavior' :: Maybe Natural
repeatFrameMsec = forall a. Maybe a
Prelude.Nothing
    }

-- | Documentation update needed
inputLossBehavior_blackFrameMsec :: Lens.Lens' InputLossBehavior (Prelude.Maybe Prelude.Natural)
inputLossBehavior_blackFrameMsec :: Lens' InputLossBehavior (Maybe Natural)
inputLossBehavior_blackFrameMsec = 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)

-- | 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 :: Lens' InputLossBehavior (Maybe Text)
inputLossBehavior_inputLossImageColor = 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)

-- | 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 :: Lens' InputLossBehavior (Maybe InputLocation)
inputLossBehavior_inputLossImageSlate = 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)

-- | 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 :: Lens' InputLossBehavior (Maybe InputLossImageType)
inputLossBehavior_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)

-- | Documentation update needed
inputLossBehavior_repeatFrameMsec :: Lens.Lens' InputLossBehavior (Prelude.Maybe Prelude.Natural)
inputLossBehavior_repeatFrameMsec :: Lens' InputLossBehavior (Maybe Natural)
inputLossBehavior_repeatFrameMsec = 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)

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

instance Prelude.Hashable InputLossBehavior where
  hashWithSalt :: Int -> InputLossBehavior -> Int
hashWithSalt Int
_salt InputLossBehavior' {Maybe Natural
Maybe Text
Maybe InputLocation
Maybe InputLossImageType
repeatFrameMsec :: Maybe Natural
inputLossImageType :: Maybe InputLossImageType
inputLossImageSlate :: Maybe InputLocation
inputLossImageColor :: Maybe Text
blackFrameMsec :: Maybe Natural
$sel:repeatFrameMsec:InputLossBehavior' :: InputLossBehavior -> Maybe Natural
$sel:inputLossImageType:InputLossBehavior' :: InputLossBehavior -> Maybe InputLossImageType
$sel:inputLossImageSlate:InputLossBehavior' :: InputLossBehavior -> Maybe InputLocation
$sel:inputLossImageColor:InputLossBehavior' :: InputLossBehavior -> Maybe Text
$sel:blackFrameMsec:InputLossBehavior' :: InputLossBehavior -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
blackFrameMsec
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inputLossImageColor
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputLocation
inputLossImageSlate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputLossImageType
inputLossImageType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
repeatFrameMsec

instance Prelude.NFData InputLossBehavior where
  rnf :: InputLossBehavior -> ()
rnf InputLossBehavior' {Maybe Natural
Maybe Text
Maybe InputLocation
Maybe InputLossImageType
repeatFrameMsec :: Maybe Natural
inputLossImageType :: Maybe InputLossImageType
inputLossImageSlate :: Maybe InputLocation
inputLossImageColor :: Maybe Text
blackFrameMsec :: Maybe Natural
$sel:repeatFrameMsec:InputLossBehavior' :: InputLossBehavior -> Maybe Natural
$sel:inputLossImageType:InputLossBehavior' :: InputLossBehavior -> Maybe InputLossImageType
$sel:inputLossImageSlate:InputLossBehavior' :: InputLossBehavior -> Maybe InputLocation
$sel:inputLossImageColor:InputLossBehavior' :: InputLossBehavior -> Maybe Text
$sel:blackFrameMsec:InputLossBehavior' :: InputLossBehavior -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
blackFrameMsec
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inputLossImageColor
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InputLocation
inputLossImageSlate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InputLossImageType
inputLossImageType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
repeatFrameMsec

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