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

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

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

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

instance Data.FromJSON MinBottomRenditionSize where
  parseJSON :: Value -> Parser MinBottomRenditionSize
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MinBottomRenditionSize"
      ( \Object
x ->
          Maybe Natural -> Maybe Natural -> MinBottomRenditionSize
MinBottomRenditionSize'
            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 MinBottomRenditionSize where
  hashWithSalt :: Int -> MinBottomRenditionSize -> Int
hashWithSalt Int
_salt MinBottomRenditionSize' {Maybe Natural
width :: Maybe Natural
height :: Maybe Natural
$sel:width:MinBottomRenditionSize' :: MinBottomRenditionSize -> Maybe Natural
$sel:height:MinBottomRenditionSize' :: MinBottomRenditionSize -> 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 MinBottomRenditionSize where
  rnf :: MinBottomRenditionSize -> ()
rnf MinBottomRenditionSize' {Maybe Natural
width :: Maybe Natural
height :: Maybe Natural
$sel:width:MinBottomRenditionSize' :: MinBottomRenditionSize -> Maybe Natural
$sel:height:MinBottomRenditionSize' :: MinBottomRenditionSize -> 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 MinBottomRenditionSize where
  toJSON :: MinBottomRenditionSize -> Value
toJSON MinBottomRenditionSize' {Maybe Natural
width :: Maybe Natural
height :: Maybe Natural
$sel:width:MinBottomRenditionSize' :: MinBottomRenditionSize -> Maybe Natural
$sel:height:MinBottomRenditionSize' :: MinBottomRenditionSize -> 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
          ]
      )