{-# 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.AvailBlanking
-- 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.AvailBlanking 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.AvailBlankingState
import Amazonka.MediaLive.Types.InputLocation
import qualified Amazonka.Prelude as Prelude

-- | Avail Blanking
--
-- /See:/ 'newAvailBlanking' smart constructor.
data AvailBlanking = AvailBlanking'
  { -- | Blanking image to be used. Leave empty for solid black. Only bmp and png
    -- images are supported.
    AvailBlanking -> Maybe InputLocation
availBlankingImage :: Prelude.Maybe InputLocation,
    -- | When set to enabled, causes video, audio and captions to be blanked when
    -- insertion metadata is added.
    AvailBlanking -> Maybe AvailBlankingState
state :: Prelude.Maybe AvailBlankingState
  }
  deriving (AvailBlanking -> AvailBlanking -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AvailBlanking -> AvailBlanking -> Bool
$c/= :: AvailBlanking -> AvailBlanking -> Bool
== :: AvailBlanking -> AvailBlanking -> Bool
$c== :: AvailBlanking -> AvailBlanking -> Bool
Prelude.Eq, ReadPrec [AvailBlanking]
ReadPrec AvailBlanking
Int -> ReadS AvailBlanking
ReadS [AvailBlanking]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AvailBlanking]
$creadListPrec :: ReadPrec [AvailBlanking]
readPrec :: ReadPrec AvailBlanking
$creadPrec :: ReadPrec AvailBlanking
readList :: ReadS [AvailBlanking]
$creadList :: ReadS [AvailBlanking]
readsPrec :: Int -> ReadS AvailBlanking
$creadsPrec :: Int -> ReadS AvailBlanking
Prelude.Read, Int -> AvailBlanking -> ShowS
[AvailBlanking] -> ShowS
AvailBlanking -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AvailBlanking] -> ShowS
$cshowList :: [AvailBlanking] -> ShowS
show :: AvailBlanking -> String
$cshow :: AvailBlanking -> String
showsPrec :: Int -> AvailBlanking -> ShowS
$cshowsPrec :: Int -> AvailBlanking -> ShowS
Prelude.Show, forall x. Rep AvailBlanking x -> AvailBlanking
forall x. AvailBlanking -> Rep AvailBlanking x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AvailBlanking x -> AvailBlanking
$cfrom :: forall x. AvailBlanking -> Rep AvailBlanking x
Prelude.Generic)

-- |
-- Create a value of 'AvailBlanking' 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:
--
-- 'availBlankingImage', 'availBlanking_availBlankingImage' - Blanking image to be used. Leave empty for solid black. Only bmp and png
-- images are supported.
--
-- 'state', 'availBlanking_state' - When set to enabled, causes video, audio and captions to be blanked when
-- insertion metadata is added.
newAvailBlanking ::
  AvailBlanking
newAvailBlanking :: AvailBlanking
newAvailBlanking =
  AvailBlanking'
    { $sel:availBlankingImage:AvailBlanking' :: Maybe InputLocation
availBlankingImage =
        forall a. Maybe a
Prelude.Nothing,
      $sel:state:AvailBlanking' :: Maybe AvailBlankingState
state = forall a. Maybe a
Prelude.Nothing
    }

-- | Blanking image to be used. Leave empty for solid black. Only bmp and png
-- images are supported.
availBlanking_availBlankingImage :: Lens.Lens' AvailBlanking (Prelude.Maybe InputLocation)
availBlanking_availBlankingImage :: Lens' AvailBlanking (Maybe InputLocation)
availBlanking_availBlankingImage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailBlanking' {Maybe InputLocation
availBlankingImage :: Maybe InputLocation
$sel:availBlankingImage:AvailBlanking' :: AvailBlanking -> Maybe InputLocation
availBlankingImage} -> Maybe InputLocation
availBlankingImage) (\s :: AvailBlanking
s@AvailBlanking' {} Maybe InputLocation
a -> AvailBlanking
s {$sel:availBlankingImage:AvailBlanking' :: Maybe InputLocation
availBlankingImage = Maybe InputLocation
a} :: AvailBlanking)

-- | When set to enabled, causes video, audio and captions to be blanked when
-- insertion metadata is added.
availBlanking_state :: Lens.Lens' AvailBlanking (Prelude.Maybe AvailBlankingState)
availBlanking_state :: Lens' AvailBlanking (Maybe AvailBlankingState)
availBlanking_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailBlanking' {Maybe AvailBlankingState
state :: Maybe AvailBlankingState
$sel:state:AvailBlanking' :: AvailBlanking -> Maybe AvailBlankingState
state} -> Maybe AvailBlankingState
state) (\s :: AvailBlanking
s@AvailBlanking' {} Maybe AvailBlankingState
a -> AvailBlanking
s {$sel:state:AvailBlanking' :: Maybe AvailBlankingState
state = Maybe AvailBlankingState
a} :: AvailBlanking)

instance Data.FromJSON AvailBlanking where
  parseJSON :: Value -> Parser AvailBlanking
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AvailBlanking"
      ( \Object
x ->
          Maybe InputLocation -> Maybe AvailBlankingState -> AvailBlanking
AvailBlanking'
            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
"availBlankingImage")
            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
"state")
      )

instance Prelude.Hashable AvailBlanking where
  hashWithSalt :: Int -> AvailBlanking -> Int
hashWithSalt Int
_salt AvailBlanking' {Maybe AvailBlankingState
Maybe InputLocation
state :: Maybe AvailBlankingState
availBlankingImage :: Maybe InputLocation
$sel:state:AvailBlanking' :: AvailBlanking -> Maybe AvailBlankingState
$sel:availBlankingImage:AvailBlanking' :: AvailBlanking -> Maybe InputLocation
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputLocation
availBlankingImage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AvailBlankingState
state

instance Prelude.NFData AvailBlanking where
  rnf :: AvailBlanking -> ()
rnf AvailBlanking' {Maybe AvailBlankingState
Maybe InputLocation
state :: Maybe AvailBlankingState
availBlankingImage :: Maybe InputLocation
$sel:state:AvailBlanking' :: AvailBlanking -> Maybe AvailBlankingState
$sel:availBlankingImage:AvailBlanking' :: AvailBlanking -> Maybe InputLocation
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe InputLocation
availBlankingImage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AvailBlankingState
state

instance Data.ToJSON AvailBlanking where
  toJSON :: AvailBlanking -> Value
toJSON AvailBlanking' {Maybe AvailBlankingState
Maybe InputLocation
state :: Maybe AvailBlankingState
availBlankingImage :: Maybe InputLocation
$sel:state:AvailBlanking' :: AvailBlanking -> Maybe AvailBlankingState
$sel:availBlankingImage:AvailBlanking' :: AvailBlanking -> Maybe InputLocation
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"availBlankingImage" 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
availBlankingImage,
            (Key
"state" 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 AvailBlankingState
state
          ]
      )