{-# 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.ElasticTranscoder.Types.JobWatermark
-- 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.ElasticTranscoder.Types.JobWatermark where

import qualified Amazonka.Core as Core
import Amazonka.ElasticTranscoder.Types.Encryption
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Watermarks can be in .png or .jpg format. If you want to display a
-- watermark that is not rectangular, use the .png format, which supports
-- transparency.
--
-- /See:/ 'newJobWatermark' smart constructor.
data JobWatermark = JobWatermark'
  { -- | The ID of the watermark settings that Elastic Transcoder uses to add
    -- watermarks to the video during transcoding. The settings are in the
    -- preset specified by Preset for the current output. In that preset, the
    -- value of Watermarks Id tells Elastic Transcoder which settings to use.
    JobWatermark -> Maybe Text
presetWatermarkId :: Prelude.Maybe Prelude.Text,
    -- | The name of the .png or .jpg file that you want to use for the
    -- watermark. To determine which Amazon S3 bucket contains the specified
    -- file, Elastic Transcoder checks the pipeline specified by @Pipeline@;
    -- the @Input Bucket@ object in that pipeline identifies the bucket.
    --
    -- If the file name includes a prefix, for example, __logos\/128x64.png__,
    -- include the prefix in the key. If the file isn\'t in the specified
    -- bucket, Elastic Transcoder returns an error.
    JobWatermark -> Maybe Text
inputKey :: Prelude.Maybe Prelude.Text,
    -- | The encryption settings, if any, that you want Elastic Transcoder to
    -- apply to your watermarks.
    JobWatermark -> Maybe Encryption
encryption :: Prelude.Maybe Encryption
  }
  deriving (JobWatermark -> JobWatermark -> Bool
(JobWatermark -> JobWatermark -> Bool)
-> (JobWatermark -> JobWatermark -> Bool) -> Eq JobWatermark
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobWatermark -> JobWatermark -> Bool
$c/= :: JobWatermark -> JobWatermark -> Bool
== :: JobWatermark -> JobWatermark -> Bool
$c== :: JobWatermark -> JobWatermark -> Bool
Prelude.Eq, ReadPrec [JobWatermark]
ReadPrec JobWatermark
Int -> ReadS JobWatermark
ReadS [JobWatermark]
(Int -> ReadS JobWatermark)
-> ReadS [JobWatermark]
-> ReadPrec JobWatermark
-> ReadPrec [JobWatermark]
-> Read JobWatermark
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobWatermark]
$creadListPrec :: ReadPrec [JobWatermark]
readPrec :: ReadPrec JobWatermark
$creadPrec :: ReadPrec JobWatermark
readList :: ReadS [JobWatermark]
$creadList :: ReadS [JobWatermark]
readsPrec :: Int -> ReadS JobWatermark
$creadsPrec :: Int -> ReadS JobWatermark
Prelude.Read, Int -> JobWatermark -> ShowS
[JobWatermark] -> ShowS
JobWatermark -> String
(Int -> JobWatermark -> ShowS)
-> (JobWatermark -> String)
-> ([JobWatermark] -> ShowS)
-> Show JobWatermark
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobWatermark] -> ShowS
$cshowList :: [JobWatermark] -> ShowS
show :: JobWatermark -> String
$cshow :: JobWatermark -> String
showsPrec :: Int -> JobWatermark -> ShowS
$cshowsPrec :: Int -> JobWatermark -> ShowS
Prelude.Show, (forall x. JobWatermark -> Rep JobWatermark x)
-> (forall x. Rep JobWatermark x -> JobWatermark)
-> Generic JobWatermark
forall x. Rep JobWatermark x -> JobWatermark
forall x. JobWatermark -> Rep JobWatermark x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobWatermark x -> JobWatermark
$cfrom :: forall x. JobWatermark -> Rep JobWatermark x
Prelude.Generic)

-- |
-- Create a value of 'JobWatermark' 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:
--
-- 'presetWatermarkId', 'jobWatermark_presetWatermarkId' - The ID of the watermark settings that Elastic Transcoder uses to add
-- watermarks to the video during transcoding. The settings are in the
-- preset specified by Preset for the current output. In that preset, the
-- value of Watermarks Id tells Elastic Transcoder which settings to use.
--
-- 'inputKey', 'jobWatermark_inputKey' - The name of the .png or .jpg file that you want to use for the
-- watermark. To determine which Amazon S3 bucket contains the specified
-- file, Elastic Transcoder checks the pipeline specified by @Pipeline@;
-- the @Input Bucket@ object in that pipeline identifies the bucket.
--
-- If the file name includes a prefix, for example, __logos\/128x64.png__,
-- include the prefix in the key. If the file isn\'t in the specified
-- bucket, Elastic Transcoder returns an error.
--
-- 'encryption', 'jobWatermark_encryption' - The encryption settings, if any, that you want Elastic Transcoder to
-- apply to your watermarks.
newJobWatermark ::
  JobWatermark
newJobWatermark :: JobWatermark
newJobWatermark =
  JobWatermark' :: Maybe Text -> Maybe Text -> Maybe Encryption -> JobWatermark
JobWatermark'
    { $sel:presetWatermarkId:JobWatermark' :: Maybe Text
presetWatermarkId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:inputKey:JobWatermark' :: Maybe Text
inputKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:encryption:JobWatermark' :: Maybe Encryption
encryption = Maybe Encryption
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the watermark settings that Elastic Transcoder uses to add
-- watermarks to the video during transcoding. The settings are in the
-- preset specified by Preset for the current output. In that preset, the
-- value of Watermarks Id tells Elastic Transcoder which settings to use.
jobWatermark_presetWatermarkId :: Lens.Lens' JobWatermark (Prelude.Maybe Prelude.Text)
jobWatermark_presetWatermarkId :: (Maybe Text -> f (Maybe Text)) -> JobWatermark -> f JobWatermark
jobWatermark_presetWatermarkId = (JobWatermark -> Maybe Text)
-> (JobWatermark -> Maybe Text -> JobWatermark)
-> Lens JobWatermark JobWatermark (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobWatermark' {Maybe Text
presetWatermarkId :: Maybe Text
$sel:presetWatermarkId:JobWatermark' :: JobWatermark -> Maybe Text
presetWatermarkId} -> Maybe Text
presetWatermarkId) (\s :: JobWatermark
s@JobWatermark' {} Maybe Text
a -> JobWatermark
s {$sel:presetWatermarkId:JobWatermark' :: Maybe Text
presetWatermarkId = Maybe Text
a} :: JobWatermark)

-- | The name of the .png or .jpg file that you want to use for the
-- watermark. To determine which Amazon S3 bucket contains the specified
-- file, Elastic Transcoder checks the pipeline specified by @Pipeline@;
-- the @Input Bucket@ object in that pipeline identifies the bucket.
--
-- If the file name includes a prefix, for example, __logos\/128x64.png__,
-- include the prefix in the key. If the file isn\'t in the specified
-- bucket, Elastic Transcoder returns an error.
jobWatermark_inputKey :: Lens.Lens' JobWatermark (Prelude.Maybe Prelude.Text)
jobWatermark_inputKey :: (Maybe Text -> f (Maybe Text)) -> JobWatermark -> f JobWatermark
jobWatermark_inputKey = (JobWatermark -> Maybe Text)
-> (JobWatermark -> Maybe Text -> JobWatermark)
-> Lens JobWatermark JobWatermark (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobWatermark' {Maybe Text
inputKey :: Maybe Text
$sel:inputKey:JobWatermark' :: JobWatermark -> Maybe Text
inputKey} -> Maybe Text
inputKey) (\s :: JobWatermark
s@JobWatermark' {} Maybe Text
a -> JobWatermark
s {$sel:inputKey:JobWatermark' :: Maybe Text
inputKey = Maybe Text
a} :: JobWatermark)

-- | The encryption settings, if any, that you want Elastic Transcoder to
-- apply to your watermarks.
jobWatermark_encryption :: Lens.Lens' JobWatermark (Prelude.Maybe Encryption)
jobWatermark_encryption :: (Maybe Encryption -> f (Maybe Encryption))
-> JobWatermark -> f JobWatermark
jobWatermark_encryption = (JobWatermark -> Maybe Encryption)
-> (JobWatermark -> Maybe Encryption -> JobWatermark)
-> Lens
     JobWatermark JobWatermark (Maybe Encryption) (Maybe Encryption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobWatermark' {Maybe Encryption
encryption :: Maybe Encryption
$sel:encryption:JobWatermark' :: JobWatermark -> Maybe Encryption
encryption} -> Maybe Encryption
encryption) (\s :: JobWatermark
s@JobWatermark' {} Maybe Encryption
a -> JobWatermark
s {$sel:encryption:JobWatermark' :: Maybe Encryption
encryption = Maybe Encryption
a} :: JobWatermark)

instance Core.FromJSON JobWatermark where
  parseJSON :: Value -> Parser JobWatermark
parseJSON =
    String
-> (Object -> Parser JobWatermark) -> Value -> Parser JobWatermark
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobWatermark"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Encryption -> JobWatermark
JobWatermark'
            (Maybe Text -> Maybe Text -> Maybe Encryption -> JobWatermark)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Encryption -> JobWatermark)
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
"PresetWatermarkId")
            Parser (Maybe Text -> Maybe Encryption -> JobWatermark)
-> Parser (Maybe Text) -> Parser (Maybe Encryption -> JobWatermark)
forall (f :: * -> *) a b. Applicative f => 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
"InputKey")
            Parser (Maybe Encryption -> JobWatermark)
-> Parser (Maybe Encryption) -> Parser JobWatermark
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Encryption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Encryption")
      )

instance Prelude.Hashable JobWatermark

instance Prelude.NFData JobWatermark

instance Core.ToJSON JobWatermark where
  toJSON :: JobWatermark -> Value
toJSON JobWatermark' {Maybe Text
Maybe Encryption
encryption :: Maybe Encryption
inputKey :: Maybe Text
presetWatermarkId :: Maybe Text
$sel:encryption:JobWatermark' :: JobWatermark -> Maybe Encryption
$sel:inputKey:JobWatermark' :: JobWatermark -> Maybe Text
$sel:presetWatermarkId:JobWatermark' :: JobWatermark -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PresetWatermarkId" 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
presetWatermarkId,
            (Text
"InputKey" 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
inputKey,
            (Text
"Encryption" Text -> Encryption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Encryption -> Pair) -> Maybe Encryption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Encryption
encryption
          ]
      )