{-# 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.MediaConvert.Types.InputVideoGenerator
-- 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.MediaConvert.Types.InputVideoGenerator where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | When you include Video generator, MediaConvert creates a video input
-- with black frames. Use this setting if you do not have a video input or
-- if you want to add black video frames before, or after, other inputs.
-- You can specify Video generator, or you can specify an Input file, but
-- you cannot specify both. For more information, see
-- https:\/\/docs.aws.amazon.com\/mediaconvert\/latest\/ug\/video-generator.html
--
-- /See:/ 'newInputVideoGenerator' smart constructor.
data InputVideoGenerator = InputVideoGenerator'
  { -- | Specify an integer value for Black video duration from 50 to 86400000 to
    -- generate a black video input for that many milliseconds. Required when
    -- you include Video generator.
    InputVideoGenerator -> Maybe Natural
duration :: Prelude.Maybe Prelude.Natural
  }
  deriving (InputVideoGenerator -> InputVideoGenerator -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputVideoGenerator -> InputVideoGenerator -> Bool
$c/= :: InputVideoGenerator -> InputVideoGenerator -> Bool
== :: InputVideoGenerator -> InputVideoGenerator -> Bool
$c== :: InputVideoGenerator -> InputVideoGenerator -> Bool
Prelude.Eq, ReadPrec [InputVideoGenerator]
ReadPrec InputVideoGenerator
Int -> ReadS InputVideoGenerator
ReadS [InputVideoGenerator]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputVideoGenerator]
$creadListPrec :: ReadPrec [InputVideoGenerator]
readPrec :: ReadPrec InputVideoGenerator
$creadPrec :: ReadPrec InputVideoGenerator
readList :: ReadS [InputVideoGenerator]
$creadList :: ReadS [InputVideoGenerator]
readsPrec :: Int -> ReadS InputVideoGenerator
$creadsPrec :: Int -> ReadS InputVideoGenerator
Prelude.Read, Int -> InputVideoGenerator -> ShowS
[InputVideoGenerator] -> ShowS
InputVideoGenerator -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputVideoGenerator] -> ShowS
$cshowList :: [InputVideoGenerator] -> ShowS
show :: InputVideoGenerator -> String
$cshow :: InputVideoGenerator -> String
showsPrec :: Int -> InputVideoGenerator -> ShowS
$cshowsPrec :: Int -> InputVideoGenerator -> ShowS
Prelude.Show, forall x. Rep InputVideoGenerator x -> InputVideoGenerator
forall x. InputVideoGenerator -> Rep InputVideoGenerator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputVideoGenerator x -> InputVideoGenerator
$cfrom :: forall x. InputVideoGenerator -> Rep InputVideoGenerator x
Prelude.Generic)

-- |
-- Create a value of 'InputVideoGenerator' 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:
--
-- 'duration', 'inputVideoGenerator_duration' - Specify an integer value for Black video duration from 50 to 86400000 to
-- generate a black video input for that many milliseconds. Required when
-- you include Video generator.
newInputVideoGenerator ::
  InputVideoGenerator
newInputVideoGenerator :: InputVideoGenerator
newInputVideoGenerator =
  InputVideoGenerator' {$sel:duration:InputVideoGenerator' :: Maybe Natural
duration = forall a. Maybe a
Prelude.Nothing}

-- | Specify an integer value for Black video duration from 50 to 86400000 to
-- generate a black video input for that many milliseconds. Required when
-- you include Video generator.
inputVideoGenerator_duration :: Lens.Lens' InputVideoGenerator (Prelude.Maybe Prelude.Natural)
inputVideoGenerator_duration :: Lens' InputVideoGenerator (Maybe Natural)
inputVideoGenerator_duration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputVideoGenerator' {Maybe Natural
duration :: Maybe Natural
$sel:duration:InputVideoGenerator' :: InputVideoGenerator -> Maybe Natural
duration} -> Maybe Natural
duration) (\s :: InputVideoGenerator
s@InputVideoGenerator' {} Maybe Natural
a -> InputVideoGenerator
s {$sel:duration:InputVideoGenerator' :: Maybe Natural
duration = Maybe Natural
a} :: InputVideoGenerator)

instance Data.FromJSON InputVideoGenerator where
  parseJSON :: Value -> Parser InputVideoGenerator
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputVideoGenerator"
      ( \Object
x ->
          Maybe Natural -> InputVideoGenerator
InputVideoGenerator'
            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
"duration")
      )

instance Prelude.Hashable InputVideoGenerator where
  hashWithSalt :: Int -> InputVideoGenerator -> Int
hashWithSalt Int
_salt InputVideoGenerator' {Maybe Natural
duration :: Maybe Natural
$sel:duration:InputVideoGenerator' :: InputVideoGenerator -> Maybe Natural
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
duration

instance Prelude.NFData InputVideoGenerator where
  rnf :: InputVideoGenerator -> ()
rnf InputVideoGenerator' {Maybe Natural
duration :: Maybe Natural
$sel:duration:InputVideoGenerator' :: InputVideoGenerator -> Maybe Natural
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
duration

instance Data.ToJSON InputVideoGenerator where
  toJSON :: InputVideoGenerator -> Value
toJSON InputVideoGenerator' {Maybe Natural
duration :: Maybe Natural
$sel:duration:InputVideoGenerator' :: InputVideoGenerator -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"duration" 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
duration]
      )