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

-- | Use Min top rendition size to specify a minimum size for the highest
-- resolution in your ABR stack. * The highest resolution in your ABR stack
-- will be equal to or greater than the value that you enter. For example:
-- If you specify 1280x720 the highest resolution in your ABR stack will be
-- equal to or greater than 1280x720. * If you specify a value for Max
-- resolution, the value that you specify for Min top rendition size must
-- be less than, or equal to, Max resolution.
--
-- /See:/ 'newMinTopRenditionSize' smart constructor.
data MinTopRenditionSize = MinTopRenditionSize'
  { -- | Use Height to define the video resolution height, in pixels, for this
    -- rule.
    MinTopRenditionSize -> Maybe Natural
height :: Prelude.Maybe Prelude.Natural,
    -- | Use Width to define the video resolution width, in pixels, for this
    -- rule.
    MinTopRenditionSize -> Maybe Natural
width :: Prelude.Maybe Prelude.Natural
  }
  deriving (MinTopRenditionSize -> MinTopRenditionSize -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MinTopRenditionSize -> MinTopRenditionSize -> Bool
$c/= :: MinTopRenditionSize -> MinTopRenditionSize -> Bool
== :: MinTopRenditionSize -> MinTopRenditionSize -> Bool
$c== :: MinTopRenditionSize -> MinTopRenditionSize -> Bool
Prelude.Eq, ReadPrec [MinTopRenditionSize]
ReadPrec MinTopRenditionSize
Int -> ReadS MinTopRenditionSize
ReadS [MinTopRenditionSize]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MinTopRenditionSize]
$creadListPrec :: ReadPrec [MinTopRenditionSize]
readPrec :: ReadPrec MinTopRenditionSize
$creadPrec :: ReadPrec MinTopRenditionSize
readList :: ReadS [MinTopRenditionSize]
$creadList :: ReadS [MinTopRenditionSize]
readsPrec :: Int -> ReadS MinTopRenditionSize
$creadsPrec :: Int -> ReadS MinTopRenditionSize
Prelude.Read, Int -> MinTopRenditionSize -> ShowS
[MinTopRenditionSize] -> ShowS
MinTopRenditionSize -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MinTopRenditionSize] -> ShowS
$cshowList :: [MinTopRenditionSize] -> ShowS
show :: MinTopRenditionSize -> String
$cshow :: MinTopRenditionSize -> String
showsPrec :: Int -> MinTopRenditionSize -> ShowS
$cshowsPrec :: Int -> MinTopRenditionSize -> ShowS
Prelude.Show, forall x. Rep MinTopRenditionSize x -> MinTopRenditionSize
forall x. MinTopRenditionSize -> Rep MinTopRenditionSize x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MinTopRenditionSize x -> MinTopRenditionSize
$cfrom :: forall x. MinTopRenditionSize -> Rep MinTopRenditionSize x
Prelude.Generic)

-- |
-- Create a value of 'MinTopRenditionSize' 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:
--
-- 'height', 'minTopRenditionSize_height' - Use Height to define the video resolution height, in pixels, for this
-- rule.
--
-- 'width', 'minTopRenditionSize_width' - Use Width to define the video resolution width, in pixels, for this
-- rule.
newMinTopRenditionSize ::
  MinTopRenditionSize
newMinTopRenditionSize :: MinTopRenditionSize
newMinTopRenditionSize =
  MinTopRenditionSize'
    { $sel:height:MinTopRenditionSize' :: Maybe Natural
height = forall a. Maybe a
Prelude.Nothing,
      $sel:width:MinTopRenditionSize' :: Maybe Natural
width = forall a. Maybe a
Prelude.Nothing
    }

-- | Use Height to define the video resolution height, in pixels, for this
-- rule.
minTopRenditionSize_height :: Lens.Lens' MinTopRenditionSize (Prelude.Maybe Prelude.Natural)
minTopRenditionSize_height :: Lens' MinTopRenditionSize (Maybe Natural)
minTopRenditionSize_height = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MinTopRenditionSize' {Maybe Natural
height :: Maybe Natural
$sel:height:MinTopRenditionSize' :: MinTopRenditionSize -> Maybe Natural
height} -> Maybe Natural
height) (\s :: MinTopRenditionSize
s@MinTopRenditionSize' {} Maybe Natural
a -> MinTopRenditionSize
s {$sel:height:MinTopRenditionSize' :: Maybe Natural
height = Maybe Natural
a} :: MinTopRenditionSize)

-- | Use Width to define the video resolution width, in pixels, for this
-- rule.
minTopRenditionSize_width :: Lens.Lens' MinTopRenditionSize (Prelude.Maybe Prelude.Natural)
minTopRenditionSize_width :: Lens' MinTopRenditionSize (Maybe Natural)
minTopRenditionSize_width = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MinTopRenditionSize' {Maybe Natural
width :: Maybe Natural
$sel:width:MinTopRenditionSize' :: MinTopRenditionSize -> Maybe Natural
width} -> Maybe Natural
width) (\s :: MinTopRenditionSize
s@MinTopRenditionSize' {} Maybe Natural
a -> MinTopRenditionSize
s {$sel:width:MinTopRenditionSize' :: Maybe Natural
width = Maybe Natural
a} :: MinTopRenditionSize)

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

instance Prelude.Hashable MinTopRenditionSize where
  hashWithSalt :: Int -> MinTopRenditionSize -> Int
hashWithSalt Int
_salt MinTopRenditionSize' {Maybe Natural
width :: Maybe Natural
height :: Maybe Natural
$sel:width:MinTopRenditionSize' :: MinTopRenditionSize -> Maybe Natural
$sel:height:MinTopRenditionSize' :: MinTopRenditionSize -> 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

instance Prelude.NFData MinTopRenditionSize where
  rnf :: MinTopRenditionSize -> ()
rnf MinTopRenditionSize' {Maybe Natural
width :: Maybe Natural
height :: Maybe Natural
$sel:width:MinTopRenditionSize' :: MinTopRenditionSize -> Maybe Natural
$sel:height:MinTopRenditionSize' :: MinTopRenditionSize -> 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

instance Data.ToJSON MinTopRenditionSize where
  toJSON :: MinTopRenditionSize -> Value
toJSON MinTopRenditionSize' {Maybe Natural
width :: Maybe Natural
height :: Maybe Natural
$sel:width:MinTopRenditionSize' :: MinTopRenditionSize -> Maybe Natural
$sel:height:MinTopRenditionSize' :: MinTopRenditionSize -> 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
          ]
      )