{-# 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.ForceIncludeRenditionSize
-- 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.ForceIncludeRenditionSize 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 Force include renditions to specify one or more resolutions to
-- include your ABR stack. * (Recommended) To optimize automated ABR,
-- specify as few resolutions as possible. * (Required) The number of
-- resolutions that you specify must be equal to, or less than, the Max
-- renditions setting. * If you specify a Min top rendition size rule,
-- specify at least one resolution that is equal to, or greater than, Min
-- top rendition size. * If you specify a Min bottom rendition size rule,
-- only specify resolutions that are equal to, or greater than, Min bottom
-- rendition size. * If you specify a Force include renditions rule, do not
-- specify a separate rule for Allowed renditions. * Note: The ABR stack
-- may include other resolutions that you do not specify here, depending on
-- the Max renditions setting.
--
-- /See:/ 'newForceIncludeRenditionSize' smart constructor.
data ForceIncludeRenditionSize = ForceIncludeRenditionSize'
  { -- | Use Height to define the video resolution height, in pixels, for this
    -- rule.
    ForceIncludeRenditionSize -> Maybe Natural
height :: Prelude.Maybe Prelude.Natural,
    -- | Use Width to define the video resolution width, in pixels, for this
    -- rule.
    ForceIncludeRenditionSize -> Maybe Natural
width :: Prelude.Maybe Prelude.Natural
  }
  deriving (ForceIncludeRenditionSize -> ForceIncludeRenditionSize -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ForceIncludeRenditionSize -> ForceIncludeRenditionSize -> Bool
$c/= :: ForceIncludeRenditionSize -> ForceIncludeRenditionSize -> Bool
== :: ForceIncludeRenditionSize -> ForceIncludeRenditionSize -> Bool
$c== :: ForceIncludeRenditionSize -> ForceIncludeRenditionSize -> Bool
Prelude.Eq, ReadPrec [ForceIncludeRenditionSize]
ReadPrec ForceIncludeRenditionSize
Int -> ReadS ForceIncludeRenditionSize
ReadS [ForceIncludeRenditionSize]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ForceIncludeRenditionSize]
$creadListPrec :: ReadPrec [ForceIncludeRenditionSize]
readPrec :: ReadPrec ForceIncludeRenditionSize
$creadPrec :: ReadPrec ForceIncludeRenditionSize
readList :: ReadS [ForceIncludeRenditionSize]
$creadList :: ReadS [ForceIncludeRenditionSize]
readsPrec :: Int -> ReadS ForceIncludeRenditionSize
$creadsPrec :: Int -> ReadS ForceIncludeRenditionSize
Prelude.Read, Int -> ForceIncludeRenditionSize -> ShowS
[ForceIncludeRenditionSize] -> ShowS
ForceIncludeRenditionSize -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ForceIncludeRenditionSize] -> ShowS
$cshowList :: [ForceIncludeRenditionSize] -> ShowS
show :: ForceIncludeRenditionSize -> String
$cshow :: ForceIncludeRenditionSize -> String
showsPrec :: Int -> ForceIncludeRenditionSize -> ShowS
$cshowsPrec :: Int -> ForceIncludeRenditionSize -> ShowS
Prelude.Show, forall x.
Rep ForceIncludeRenditionSize x -> ForceIncludeRenditionSize
forall x.
ForceIncludeRenditionSize -> Rep ForceIncludeRenditionSize x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ForceIncludeRenditionSize x -> ForceIncludeRenditionSize
$cfrom :: forall x.
ForceIncludeRenditionSize -> Rep ForceIncludeRenditionSize x
Prelude.Generic)

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

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

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

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