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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticTranscoder.Types.Encryption
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 encryption settings, if any, that you want Elastic Transcoder to
    -- apply to your watermarks.
    JobWatermark -> Maybe Encryption
encryption :: Prelude.Maybe Encryption,
    -- | 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 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
  }
  deriving (JobWatermark -> JobWatermark -> Bool
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]
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
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. 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:
--
-- 'encryption', 'jobWatermark_encryption' - The encryption settings, if any, that you want Elastic Transcoder to
-- apply to your watermarks.
--
-- '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.
--
-- '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.
newJobWatermark ::
  JobWatermark
newJobWatermark :: JobWatermark
newJobWatermark =
  JobWatermark'
    { $sel:encryption:JobWatermark' :: Maybe Encryption
encryption = forall a. Maybe a
Prelude.Nothing,
      $sel:inputKey:JobWatermark' :: Maybe Text
inputKey = forall a. Maybe a
Prelude.Nothing,
      $sel:presetWatermarkId:JobWatermark' :: Maybe Text
presetWatermarkId = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' JobWatermark (Maybe Encryption)
jobWatermark_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)

-- | 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 :: Lens' JobWatermark (Maybe Text)
jobWatermark_inputKey = 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 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 :: Lens' JobWatermark (Maybe Text)
jobWatermark_presetWatermarkId = 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)

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

instance Prelude.Hashable JobWatermark where
  hashWithSalt :: Int -> JobWatermark -> Int
hashWithSalt Int
_salt JobWatermark' {Maybe Text
Maybe Encryption
presetWatermarkId :: Maybe Text
inputKey :: Maybe Text
encryption :: Maybe Encryption
$sel:presetWatermarkId:JobWatermark' :: JobWatermark -> Maybe Text
$sel:inputKey:JobWatermark' :: JobWatermark -> Maybe Text
$sel:encryption:JobWatermark' :: JobWatermark -> Maybe Encryption
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Encryption
encryption
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inputKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
presetWatermarkId

instance Prelude.NFData JobWatermark where
  rnf :: JobWatermark -> ()
rnf JobWatermark' {Maybe Text
Maybe Encryption
presetWatermarkId :: Maybe Text
inputKey :: Maybe Text
encryption :: Maybe Encryption
$sel:presetWatermarkId:JobWatermark' :: JobWatermark -> Maybe Text
$sel:inputKey:JobWatermark' :: JobWatermark -> Maybe Text
$sel:encryption:JobWatermark' :: JobWatermark -> Maybe Encryption
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Encryption
encryption
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inputKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
presetWatermarkId

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