{-# 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.Lens as Lens
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
(Rectangle -> Rectangle -> Bool)
-> (Rectangle -> Rectangle -> Bool) -> Eq Rectangle
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]
(Int -> ReadS Rectangle)
-> ReadS [Rectangle]
-> ReadPrec Rectangle
-> ReadPrec [Rectangle]
-> Read 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
(Int -> Rectangle -> ShowS)
-> (Rectangle -> String)
-> ([Rectangle] -> ShowS)
-> Show Rectangle
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. Rectangle -> Rep Rectangle x)
-> (forall x. Rep Rectangle x -> Rectangle) -> Generic Rectangle
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' :: Maybe Natural
-> Maybe Natural -> Maybe Natural -> Maybe Natural -> Rectangle
Rectangle'
{ $sel:height:Rectangle' :: Maybe Natural
height = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:width:Rectangle' :: Maybe Natural
width = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:x:Rectangle' :: Maybe Natural
x = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:y:Rectangle' :: Maybe Natural
y = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
rectangle_height :: Lens.Lens' Rectangle (Prelude.Maybe Prelude.Natural)
rectangle_height :: (Maybe Natural -> f (Maybe Natural)) -> Rectangle -> f Rectangle
rectangle_height = (Rectangle -> Maybe Natural)
-> (Rectangle -> Maybe Natural -> Rectangle)
-> Lens Rectangle Rectangle (Maybe Natural) (Maybe Natural)
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 :: (Maybe Natural -> f (Maybe Natural)) -> Rectangle -> f Rectangle
rectangle_width = (Rectangle -> Maybe Natural)
-> (Rectangle -> Maybe Natural -> Rectangle)
-> Lens Rectangle Rectangle (Maybe Natural) (Maybe Natural)
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 :: (Maybe Natural -> f (Maybe Natural)) -> Rectangle -> f Rectangle
rectangle_x = (Rectangle -> Maybe Natural)
-> (Rectangle -> Maybe Natural -> Rectangle)
-> Lens Rectangle Rectangle (Maybe Natural) (Maybe Natural)
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 :: (Maybe Natural -> f (Maybe Natural)) -> Rectangle -> f Rectangle
rectangle_y = (Rectangle -> Maybe Natural)
-> (Rectangle -> Maybe Natural -> Rectangle)
-> Lens Rectangle Rectangle (Maybe Natural) (Maybe Natural)
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 Core.FromJSON Rectangle where
parseJSON :: Value -> Parser Rectangle
parseJSON =
String -> (Object -> Parser Rectangle) -> Value -> Parser Rectangle
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Rectangle"
( \Object
x ->
Maybe Natural
-> Maybe Natural -> Maybe Natural -> Maybe Natural -> Rectangle
Rectangle'
(Maybe Natural
-> Maybe Natural -> Maybe Natural -> Maybe Natural -> Rectangle)
-> Parser (Maybe Natural)
-> Parser
(Maybe Natural -> Maybe Natural -> Maybe Natural -> Rectangle)
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
"height")
Parser
(Maybe Natural -> Maybe Natural -> Maybe Natural -> Rectangle)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Maybe Natural -> Rectangle)
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
"width")
Parser (Maybe Natural -> Maybe Natural -> Rectangle)
-> Parser (Maybe Natural) -> Parser (Maybe Natural -> Rectangle)
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
"x")
Parser (Maybe Natural -> Rectangle)
-> Parser (Maybe Natural) -> Parser Rectangle
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
"y")
)
instance Prelude.Hashable Rectangle
instance Prelude.NFData Rectangle
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"height" 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
height,
(Text
"width" 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
width,
(Text
"x" 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
x,
(Text
"y" 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
y
]
)