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

-- | 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
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]
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
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.
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'
    { $sel:imageX:MotionImageInsertionOffset' :: Maybe Natural
imageX =
        forall a. Maybe a
Prelude.Nothing,
      $sel:imageY:MotionImageInsertionOffset' :: Maybe Natural
imageY = 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 :: Lens' MotionImageInsertionOffset (Maybe Natural)
motionImageInsertionOffset_imageX = 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 :: Lens' MotionImageInsertionOffset (Maybe Natural)
motionImageInsertionOffset_imageY = 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 Data.FromJSON MotionImageInsertionOffset where
  parseJSON :: Value -> Parser MotionImageInsertionOffset
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MotionImageInsertionOffset"
      ( \Object
x ->
          Maybe Natural -> Maybe Natural -> MotionImageInsertionOffset
MotionImageInsertionOffset'
            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
"imageX")
            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
"imageY")
      )

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

instance Prelude.NFData MotionImageInsertionOffset where
  rnf :: MotionImageInsertionOffset -> ()
rnf MotionImageInsertionOffset' {Maybe Natural
imageY :: Maybe Natural
imageX :: Maybe Natural
$sel:imageY:MotionImageInsertionOffset' :: MotionImageInsertionOffset -> Maybe Natural
$sel:imageX:MotionImageInsertionOffset' :: MotionImageInsertionOffset -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
imageX seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
imageY

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"imageX" 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
imageX,
            (Key
"imageY" 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
imageY
          ]
      )