{-# 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 #-}
module Amazonka.MediaConvert.Types.Rectangle 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
data Rectangle = Rectangle'
{
Rectangle -> Maybe Natural
height :: Prelude.Maybe Prelude.Natural,
Rectangle -> Maybe Natural
width :: Prelude.Maybe Prelude.Natural,
Rectangle -> Maybe Natural
x :: Prelude.Maybe Prelude.Natural,
Rectangle -> Maybe Natural
y :: Prelude.Maybe Prelude.Natural
}
deriving (Rectangle -> Rectangle -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Rectangle -> Rectangle -> Bool
$c/= :: Rectangle -> Rectangle -> Bool
== :: Rectangle -> Rectangle -> Bool
$c== :: Rectangle -> Rectangle -> Bool
Prelude.Eq, ReadPrec [Rectangle]
ReadPrec Rectangle
Int -> ReadS Rectangle
ReadS [Rectangle]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Rectangle]
$creadListPrec :: ReadPrec [Rectangle]
readPrec :: ReadPrec Rectangle
$creadPrec :: ReadPrec Rectangle
readList :: ReadS [Rectangle]
$creadList :: ReadS [Rectangle]
readsPrec :: Int -> ReadS Rectangle
$creadsPrec :: Int -> ReadS Rectangle
Prelude.Read, Int -> Rectangle -> ShowS
[Rectangle] -> ShowS
Rectangle -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Rectangle] -> ShowS
$cshowList :: [Rectangle] -> ShowS
show :: Rectangle -> String
$cshow :: Rectangle -> String
showsPrec :: Int -> Rectangle -> ShowS
$cshowsPrec :: Int -> Rectangle -> ShowS
Prelude.Show, forall x. Rep Rectangle x -> Rectangle
forall x. Rectangle -> Rep Rectangle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Rectangle x -> Rectangle
$cfrom :: forall x. Rectangle -> Rep Rectangle x
Prelude.Generic)
newRectangle ::
Rectangle
newRectangle :: Rectangle
newRectangle =
Rectangle'
{ $sel:height:Rectangle' :: Maybe Natural
height = forall a. Maybe a
Prelude.Nothing,
$sel:width:Rectangle' :: Maybe Natural
width = forall a. Maybe a
Prelude.Nothing,
$sel:x:Rectangle' :: Maybe Natural
x = forall a. Maybe a
Prelude.Nothing,
$sel:y:Rectangle' :: Maybe Natural
y = forall a. Maybe a
Prelude.Nothing
}
rectangle_height :: Lens.Lens' Rectangle (Prelude.Maybe Prelude.Natural)
rectangle_height :: Lens' Rectangle (Maybe Natural)
rectangle_height = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rectangle' {Maybe Natural
height :: Maybe Natural
$sel:height:Rectangle' :: Rectangle -> Maybe Natural
height} -> Maybe Natural
height) (\s :: Rectangle
s@Rectangle' {} Maybe Natural
a -> Rectangle
s {$sel:height:Rectangle' :: Maybe Natural
height = Maybe Natural
a} :: Rectangle)
rectangle_width :: Lens.Lens' Rectangle (Prelude.Maybe Prelude.Natural)
rectangle_width :: Lens' Rectangle (Maybe Natural)
rectangle_width = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rectangle' {Maybe Natural
width :: Maybe Natural
$sel:width:Rectangle' :: Rectangle -> Maybe Natural
width} -> Maybe Natural
width) (\s :: Rectangle
s@Rectangle' {} Maybe Natural
a -> Rectangle
s {$sel:width:Rectangle' :: Maybe Natural
width = Maybe Natural
a} :: Rectangle)
rectangle_x :: Lens.Lens' Rectangle (Prelude.Maybe Prelude.Natural)
rectangle_x :: Lens' Rectangle (Maybe Natural)
rectangle_x = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rectangle' {Maybe Natural
x :: Maybe Natural
$sel:x:Rectangle' :: Rectangle -> Maybe Natural
x} -> Maybe Natural
x) (\s :: Rectangle
s@Rectangle' {} Maybe Natural
a -> Rectangle
s {$sel:x:Rectangle' :: Maybe Natural
x = Maybe Natural
a} :: Rectangle)
rectangle_y :: Lens.Lens' Rectangle (Prelude.Maybe Prelude.Natural)
rectangle_y :: Lens' Rectangle (Maybe Natural)
rectangle_y = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Rectangle' {Maybe Natural
y :: Maybe Natural
$sel:y:Rectangle' :: Rectangle -> Maybe Natural
y} -> Maybe Natural
y) (\s :: Rectangle
s@Rectangle' {} Maybe Natural
a -> Rectangle
s {$sel:y:Rectangle' :: Maybe Natural
y = Maybe Natural
a} :: Rectangle)
instance Data.FromJSON Rectangle where
parseJSON :: Value -> Parser Rectangle
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Rectangle"
( \Object
x ->
Maybe Natural
-> Maybe Natural -> Maybe Natural -> Maybe Natural -> Rectangle
Rectangle'
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
"height")
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
"width")
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
"x")
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
"y")
)
instance Prelude.Hashable Rectangle where
hashWithSalt :: Int -> Rectangle -> Int
hashWithSalt Int
_salt Rectangle' {Maybe Natural
y :: Maybe Natural
x :: Maybe Natural
width :: Maybe Natural
height :: Maybe Natural
$sel:y:Rectangle' :: Rectangle -> Maybe Natural
$sel:x:Rectangle' :: Rectangle -> Maybe Natural
$sel:width:Rectangle' :: Rectangle -> Maybe Natural
$sel:height:Rectangle' :: Rectangle -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
height
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
width
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
x
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
y
instance Prelude.NFData Rectangle where
rnf :: Rectangle -> ()
rnf Rectangle' {Maybe Natural
y :: Maybe Natural
x :: Maybe Natural
width :: Maybe Natural
height :: Maybe Natural
$sel:y:Rectangle' :: Rectangle -> Maybe Natural
$sel:x:Rectangle' :: Rectangle -> Maybe Natural
$sel:width:Rectangle' :: Rectangle -> Maybe Natural
$sel:height:Rectangle' :: Rectangle -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
height
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
width
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
x
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
y
instance Data.ToJSON Rectangle where
toJSON :: Rectangle -> Value
toJSON Rectangle' {Maybe Natural
y :: Maybe Natural
x :: Maybe Natural
width :: Maybe Natural
height :: Maybe Natural
$sel:y:Rectangle' :: Rectangle -> Maybe Natural
$sel:x:Rectangle' :: Rectangle -> Maybe Natural
$sel:width:Rectangle' :: Rectangle -> Maybe Natural
$sel:height:Rectangle' :: Rectangle -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"height" 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
height,
(Key
"width" 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
width,
(Key
"x" 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
x,
(Key
"y" 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
y
]
)