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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.InsertableImage
import qualified Amazonka.Prelude as Prelude

-- | Use the image inserter feature to include a graphic overlay on your
-- video. Enable or disable this feature for each input or output
-- individually. For more information, see
-- https:\/\/docs.aws.amazon.com\/mediaconvert\/latest\/ug\/graphic-overlay.html.
-- This setting is disabled by default.
--
-- /See:/ 'newImageInserter' smart constructor.
data ImageInserter = ImageInserter'
  { -- | Specify the images that you want to overlay on your video. The images
    -- must be PNG or TGA files.
    ImageInserter -> Maybe [InsertableImage]
insertableImages :: Prelude.Maybe [InsertableImage]
  }
  deriving (ImageInserter -> ImageInserter -> Bool
(ImageInserter -> ImageInserter -> Bool)
-> (ImageInserter -> ImageInserter -> Bool) -> Eq ImageInserter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageInserter -> ImageInserter -> Bool
$c/= :: ImageInserter -> ImageInserter -> Bool
== :: ImageInserter -> ImageInserter -> Bool
$c== :: ImageInserter -> ImageInserter -> Bool
Prelude.Eq, ReadPrec [ImageInserter]
ReadPrec ImageInserter
Int -> ReadS ImageInserter
ReadS [ImageInserter]
(Int -> ReadS ImageInserter)
-> ReadS [ImageInserter]
-> ReadPrec ImageInserter
-> ReadPrec [ImageInserter]
-> Read ImageInserter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImageInserter]
$creadListPrec :: ReadPrec [ImageInserter]
readPrec :: ReadPrec ImageInserter
$creadPrec :: ReadPrec ImageInserter
readList :: ReadS [ImageInserter]
$creadList :: ReadS [ImageInserter]
readsPrec :: Int -> ReadS ImageInserter
$creadsPrec :: Int -> ReadS ImageInserter
Prelude.Read, Int -> ImageInserter -> ShowS
[ImageInserter] -> ShowS
ImageInserter -> String
(Int -> ImageInserter -> ShowS)
-> (ImageInserter -> String)
-> ([ImageInserter] -> ShowS)
-> Show ImageInserter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageInserter] -> ShowS
$cshowList :: [ImageInserter] -> ShowS
show :: ImageInserter -> String
$cshow :: ImageInserter -> String
showsPrec :: Int -> ImageInserter -> ShowS
$cshowsPrec :: Int -> ImageInserter -> ShowS
Prelude.Show, (forall x. ImageInserter -> Rep ImageInserter x)
-> (forall x. Rep ImageInserter x -> ImageInserter)
-> Generic ImageInserter
forall x. Rep ImageInserter x -> ImageInserter
forall x. ImageInserter -> Rep ImageInserter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageInserter x -> ImageInserter
$cfrom :: forall x. ImageInserter -> Rep ImageInserter x
Prelude.Generic)

-- |
-- Create a value of 'ImageInserter' 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:
--
-- 'insertableImages', 'imageInserter_insertableImages' - Specify the images that you want to overlay on your video. The images
-- must be PNG or TGA files.
newImageInserter ::
  ImageInserter
newImageInserter :: ImageInserter
newImageInserter =
  ImageInserter' :: Maybe [InsertableImage] -> ImageInserter
ImageInserter' {$sel:insertableImages:ImageInserter' :: Maybe [InsertableImage]
insertableImages = Maybe [InsertableImage]
forall a. Maybe a
Prelude.Nothing}

-- | Specify the images that you want to overlay on your video. The images
-- must be PNG or TGA files.
imageInserter_insertableImages :: Lens.Lens' ImageInserter (Prelude.Maybe [InsertableImage])
imageInserter_insertableImages :: (Maybe [InsertableImage] -> f (Maybe [InsertableImage]))
-> ImageInserter -> f ImageInserter
imageInserter_insertableImages = (ImageInserter -> Maybe [InsertableImage])
-> (ImageInserter -> Maybe [InsertableImage] -> ImageInserter)
-> Lens
     ImageInserter
     ImageInserter
     (Maybe [InsertableImage])
     (Maybe [InsertableImage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageInserter' {Maybe [InsertableImage]
insertableImages :: Maybe [InsertableImage]
$sel:insertableImages:ImageInserter' :: ImageInserter -> Maybe [InsertableImage]
insertableImages} -> Maybe [InsertableImage]
insertableImages) (\s :: ImageInserter
s@ImageInserter' {} Maybe [InsertableImage]
a -> ImageInserter
s {$sel:insertableImages:ImageInserter' :: Maybe [InsertableImage]
insertableImages = Maybe [InsertableImage]
a} :: ImageInserter) ((Maybe [InsertableImage] -> f (Maybe [InsertableImage]))
 -> ImageInserter -> f ImageInserter)
-> ((Maybe [InsertableImage] -> f (Maybe [InsertableImage]))
    -> Maybe [InsertableImage] -> f (Maybe [InsertableImage]))
-> (Maybe [InsertableImage] -> f (Maybe [InsertableImage]))
-> ImageInserter
-> f ImageInserter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InsertableImage]
  [InsertableImage]
  [InsertableImage]
  [InsertableImage]
-> Iso
     (Maybe [InsertableImage])
     (Maybe [InsertableImage])
     (Maybe [InsertableImage])
     (Maybe [InsertableImage])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [InsertableImage]
  [InsertableImage]
  [InsertableImage]
  [InsertableImage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ImageInserter where
  parseJSON :: Value -> Parser ImageInserter
parseJSON =
    String
-> (Object -> Parser ImageInserter)
-> Value
-> Parser ImageInserter
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ImageInserter"
      ( \Object
x ->
          Maybe [InsertableImage] -> ImageInserter
ImageInserter'
            (Maybe [InsertableImage] -> ImageInserter)
-> Parser (Maybe [InsertableImage]) -> Parser ImageInserter
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [InsertableImage]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"insertableImages"
                            Parser (Maybe (Maybe [InsertableImage]))
-> Maybe [InsertableImage] -> Parser (Maybe [InsertableImage])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [InsertableImage]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ImageInserter

instance Prelude.NFData ImageInserter

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