{-# 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.MotionImageInsertionOffset
-- 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.MotionImageInsertionOffset where

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

-- | Specify the offset between the upper-left corner of the video frame and
-- the top left corner of the overlay.
--
-- /See:/ 'newMotionImageInsertionOffset' smart constructor.
data MotionImageInsertionOffset = MotionImageInsertionOffset'
  { -- | Set the distance, in pixels, between the overlay and the left edge of
    -- the video frame.
    MotionImageInsertionOffset -> Maybe Natural
imageX :: Prelude.Maybe Prelude.Natural,
    -- | Set the distance, in pixels, between the overlay and the top edge of the
    -- video frame.
    MotionImageInsertionOffset -> Maybe Natural
imageY :: Prelude.Maybe Prelude.Natural
  }
  deriving (MotionImageInsertionOffset -> MotionImageInsertionOffset -> Bool
(MotionImageInsertionOffset -> MotionImageInsertionOffset -> Bool)
-> (MotionImageInsertionOffset
    -> MotionImageInsertionOffset -> Bool)
-> Eq MotionImageInsertionOffset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MotionImageInsertionOffset -> MotionImageInsertionOffset -> Bool
$c/= :: MotionImageInsertionOffset -> MotionImageInsertionOffset -> Bool
== :: MotionImageInsertionOffset -> MotionImageInsertionOffset -> Bool
$c== :: MotionImageInsertionOffset -> MotionImageInsertionOffset -> Bool
Prelude.Eq, ReadPrec [MotionImageInsertionOffset]
ReadPrec MotionImageInsertionOffset
Int -> ReadS MotionImageInsertionOffset
ReadS [MotionImageInsertionOffset]
(Int -> ReadS MotionImageInsertionOffset)
-> ReadS [MotionImageInsertionOffset]
-> ReadPrec MotionImageInsertionOffset
-> ReadPrec [MotionImageInsertionOffset]
-> Read MotionImageInsertionOffset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MotionImageInsertionOffset]
$creadListPrec :: ReadPrec [MotionImageInsertionOffset]
readPrec :: ReadPrec MotionImageInsertionOffset
$creadPrec :: ReadPrec MotionImageInsertionOffset
readList :: ReadS [MotionImageInsertionOffset]
$creadList :: ReadS [MotionImageInsertionOffset]
readsPrec :: Int -> ReadS MotionImageInsertionOffset
$creadsPrec :: Int -> ReadS MotionImageInsertionOffset
Prelude.Read, Int -> MotionImageInsertionOffset -> ShowS
[MotionImageInsertionOffset] -> ShowS
MotionImageInsertionOffset -> String
(Int -> MotionImageInsertionOffset -> ShowS)
-> (MotionImageInsertionOffset -> String)
-> ([MotionImageInsertionOffset] -> ShowS)
-> Show MotionImageInsertionOffset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MotionImageInsertionOffset] -> ShowS
$cshowList :: [MotionImageInsertionOffset] -> ShowS
show :: MotionImageInsertionOffset -> String
$cshow :: MotionImageInsertionOffset -> String
showsPrec :: Int -> MotionImageInsertionOffset -> ShowS
$cshowsPrec :: Int -> MotionImageInsertionOffset -> ShowS
Prelude.Show, (forall x.
 MotionImageInsertionOffset -> Rep MotionImageInsertionOffset x)
-> (forall x.
    Rep MotionImageInsertionOffset x -> MotionImageInsertionOffset)
-> Generic MotionImageInsertionOffset
forall x.
Rep MotionImageInsertionOffset x -> MotionImageInsertionOffset
forall x.
MotionImageInsertionOffset -> Rep MotionImageInsertionOffset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MotionImageInsertionOffset x -> MotionImageInsertionOffset
$cfrom :: forall x.
MotionImageInsertionOffset -> Rep MotionImageInsertionOffset x
Prelude.Generic)

-- |
-- Create a value of 'MotionImageInsertionOffset' 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:
--
-- 'imageX', 'motionImageInsertionOffset_imageX' - Set the distance, in pixels, between the overlay and the left edge of
-- the video frame.
--
-- 'imageY', 'motionImageInsertionOffset_imageY' - Set the distance, in pixels, between the overlay and the top edge of the
-- video frame.
newMotionImageInsertionOffset ::
  MotionImageInsertionOffset
newMotionImageInsertionOffset :: MotionImageInsertionOffset
newMotionImageInsertionOffset =
  MotionImageInsertionOffset' :: Maybe Natural -> Maybe Natural -> MotionImageInsertionOffset
MotionImageInsertionOffset'
    { $sel:imageX:MotionImageInsertionOffset' :: Maybe Natural
imageX =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:imageY:MotionImageInsertionOffset' :: Maybe Natural
imageY = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Set the distance, in pixels, between the overlay and the left edge of
-- the video frame.
motionImageInsertionOffset_imageX :: Lens.Lens' MotionImageInsertionOffset (Prelude.Maybe Prelude.Natural)
motionImageInsertionOffset_imageX :: (Maybe Natural -> f (Maybe Natural))
-> MotionImageInsertionOffset -> f MotionImageInsertionOffset
motionImageInsertionOffset_imageX = (MotionImageInsertionOffset -> Maybe Natural)
-> (MotionImageInsertionOffset
    -> Maybe Natural -> MotionImageInsertionOffset)
-> Lens
     MotionImageInsertionOffset
     MotionImageInsertionOffset
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MotionImageInsertionOffset' {Maybe Natural
imageX :: Maybe Natural
$sel:imageX:MotionImageInsertionOffset' :: MotionImageInsertionOffset -> Maybe Natural
imageX} -> Maybe Natural
imageX) (\s :: MotionImageInsertionOffset
s@MotionImageInsertionOffset' {} Maybe Natural
a -> MotionImageInsertionOffset
s {$sel:imageX:MotionImageInsertionOffset' :: Maybe Natural
imageX = Maybe Natural
a} :: MotionImageInsertionOffset)

-- | Set the distance, in pixels, between the overlay and the top edge of the
-- video frame.
motionImageInsertionOffset_imageY :: Lens.Lens' MotionImageInsertionOffset (Prelude.Maybe Prelude.Natural)
motionImageInsertionOffset_imageY :: (Maybe Natural -> f (Maybe Natural))
-> MotionImageInsertionOffset -> f MotionImageInsertionOffset
motionImageInsertionOffset_imageY = (MotionImageInsertionOffset -> Maybe Natural)
-> (MotionImageInsertionOffset
    -> Maybe Natural -> MotionImageInsertionOffset)
-> Lens
     MotionImageInsertionOffset
     MotionImageInsertionOffset
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MotionImageInsertionOffset' {Maybe Natural
imageY :: Maybe Natural
$sel:imageY:MotionImageInsertionOffset' :: MotionImageInsertionOffset -> Maybe Natural
imageY} -> Maybe Natural
imageY) (\s :: MotionImageInsertionOffset
s@MotionImageInsertionOffset' {} Maybe Natural
a -> MotionImageInsertionOffset
s {$sel:imageY:MotionImageInsertionOffset' :: Maybe Natural
imageY = Maybe Natural
a} :: MotionImageInsertionOffset)

instance Core.FromJSON MotionImageInsertionOffset where
  parseJSON :: Value -> Parser MotionImageInsertionOffset
parseJSON =
    String
-> (Object -> Parser MotionImageInsertionOffset)
-> Value
-> Parser MotionImageInsertionOffset
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MotionImageInsertionOffset"
      ( \Object
x ->
          Maybe Natural -> Maybe Natural -> MotionImageInsertionOffset
MotionImageInsertionOffset'
            (Maybe Natural -> Maybe Natural -> MotionImageInsertionOffset)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> MotionImageInsertionOffset)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"imageX")
            Parser (Maybe Natural -> MotionImageInsertionOffset)
-> Parser (Maybe Natural) -> Parser MotionImageInsertionOffset
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"imageY")
      )

instance Prelude.Hashable MotionImageInsertionOffset

instance Prelude.NFData MotionImageInsertionOffset

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