{-# 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.MediaLive.Types.InputSpecification
-- 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.MediaLive.Types.InputSpecification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.InputCodec
import Amazonka.MediaLive.Types.InputMaximumBitrate
import Amazonka.MediaLive.Types.InputResolution
import qualified Amazonka.Prelude as Prelude

-- | Placeholder documentation for InputSpecification
--
-- /See:/ 'newInputSpecification' smart constructor.
data InputSpecification = InputSpecification'
  { -- | Input codec
    InputSpecification -> Maybe InputCodec
codec :: Prelude.Maybe InputCodec,
    -- | Maximum input bitrate, categorized coarsely
    InputSpecification -> Maybe InputMaximumBitrate
maximumBitrate :: Prelude.Maybe InputMaximumBitrate,
    -- | Input resolution, categorized coarsely
    InputSpecification -> Maybe InputResolution
resolution :: Prelude.Maybe InputResolution
  }
  deriving (InputSpecification -> InputSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputSpecification -> InputSpecification -> Bool
$c/= :: InputSpecification -> InputSpecification -> Bool
== :: InputSpecification -> InputSpecification -> Bool
$c== :: InputSpecification -> InputSpecification -> Bool
Prelude.Eq, ReadPrec [InputSpecification]
ReadPrec InputSpecification
Int -> ReadS InputSpecification
ReadS [InputSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputSpecification]
$creadListPrec :: ReadPrec [InputSpecification]
readPrec :: ReadPrec InputSpecification
$creadPrec :: ReadPrec InputSpecification
readList :: ReadS [InputSpecification]
$creadList :: ReadS [InputSpecification]
readsPrec :: Int -> ReadS InputSpecification
$creadsPrec :: Int -> ReadS InputSpecification
Prelude.Read, Int -> InputSpecification -> ShowS
[InputSpecification] -> ShowS
InputSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputSpecification] -> ShowS
$cshowList :: [InputSpecification] -> ShowS
show :: InputSpecification -> String
$cshow :: InputSpecification -> String
showsPrec :: Int -> InputSpecification -> ShowS
$cshowsPrec :: Int -> InputSpecification -> ShowS
Prelude.Show, forall x. Rep InputSpecification x -> InputSpecification
forall x. InputSpecification -> Rep InputSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputSpecification x -> InputSpecification
$cfrom :: forall x. InputSpecification -> Rep InputSpecification x
Prelude.Generic)

-- |
-- Create a value of 'InputSpecification' 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:
--
-- 'codec', 'inputSpecification_codec' - Input codec
--
-- 'maximumBitrate', 'inputSpecification_maximumBitrate' - Maximum input bitrate, categorized coarsely
--
-- 'resolution', 'inputSpecification_resolution' - Input resolution, categorized coarsely
newInputSpecification ::
  InputSpecification
newInputSpecification :: InputSpecification
newInputSpecification =
  InputSpecification'
    { $sel:codec:InputSpecification' :: Maybe InputCodec
codec = forall a. Maybe a
Prelude.Nothing,
      $sel:maximumBitrate:InputSpecification' :: Maybe InputMaximumBitrate
maximumBitrate = forall a. Maybe a
Prelude.Nothing,
      $sel:resolution:InputSpecification' :: Maybe InputResolution
resolution = forall a. Maybe a
Prelude.Nothing
    }

-- | Input codec
inputSpecification_codec :: Lens.Lens' InputSpecification (Prelude.Maybe InputCodec)
inputSpecification_codec :: Lens' InputSpecification (Maybe InputCodec)
inputSpecification_codec = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSpecification' {Maybe InputCodec
codec :: Maybe InputCodec
$sel:codec:InputSpecification' :: InputSpecification -> Maybe InputCodec
codec} -> Maybe InputCodec
codec) (\s :: InputSpecification
s@InputSpecification' {} Maybe InputCodec
a -> InputSpecification
s {$sel:codec:InputSpecification' :: Maybe InputCodec
codec = Maybe InputCodec
a} :: InputSpecification)

-- | Maximum input bitrate, categorized coarsely
inputSpecification_maximumBitrate :: Lens.Lens' InputSpecification (Prelude.Maybe InputMaximumBitrate)
inputSpecification_maximumBitrate :: Lens' InputSpecification (Maybe InputMaximumBitrate)
inputSpecification_maximumBitrate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSpecification' {Maybe InputMaximumBitrate
maximumBitrate :: Maybe InputMaximumBitrate
$sel:maximumBitrate:InputSpecification' :: InputSpecification -> Maybe InputMaximumBitrate
maximumBitrate} -> Maybe InputMaximumBitrate
maximumBitrate) (\s :: InputSpecification
s@InputSpecification' {} Maybe InputMaximumBitrate
a -> InputSpecification
s {$sel:maximumBitrate:InputSpecification' :: Maybe InputMaximumBitrate
maximumBitrate = Maybe InputMaximumBitrate
a} :: InputSpecification)

-- | Input resolution, categorized coarsely
inputSpecification_resolution :: Lens.Lens' InputSpecification (Prelude.Maybe InputResolution)
inputSpecification_resolution :: Lens' InputSpecification (Maybe InputResolution)
inputSpecification_resolution = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSpecification' {Maybe InputResolution
resolution :: Maybe InputResolution
$sel:resolution:InputSpecification' :: InputSpecification -> Maybe InputResolution
resolution} -> Maybe InputResolution
resolution) (\s :: InputSpecification
s@InputSpecification' {} Maybe InputResolution
a -> InputSpecification
s {$sel:resolution:InputSpecification' :: Maybe InputResolution
resolution = Maybe InputResolution
a} :: InputSpecification)

instance Data.FromJSON InputSpecification where
  parseJSON :: Value -> Parser InputSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputSpecification"
      ( \Object
x ->
          Maybe InputCodec
-> Maybe InputMaximumBitrate
-> Maybe InputResolution
-> InputSpecification
InputSpecification'
            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
"codec")
            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
"maximumBitrate")
            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
"resolution")
      )

instance Prelude.Hashable InputSpecification where
  hashWithSalt :: Int -> InputSpecification -> Int
hashWithSalt Int
_salt InputSpecification' {Maybe InputCodec
Maybe InputMaximumBitrate
Maybe InputResolution
resolution :: Maybe InputResolution
maximumBitrate :: Maybe InputMaximumBitrate
codec :: Maybe InputCodec
$sel:resolution:InputSpecification' :: InputSpecification -> Maybe InputResolution
$sel:maximumBitrate:InputSpecification' :: InputSpecification -> Maybe InputMaximumBitrate
$sel:codec:InputSpecification' :: InputSpecification -> Maybe InputCodec
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputCodec
codec
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputMaximumBitrate
maximumBitrate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputResolution
resolution

instance Prelude.NFData InputSpecification where
  rnf :: InputSpecification -> ()
rnf InputSpecification' {Maybe InputCodec
Maybe InputMaximumBitrate
Maybe InputResolution
resolution :: Maybe InputResolution
maximumBitrate :: Maybe InputMaximumBitrate
codec :: Maybe InputCodec
$sel:resolution:InputSpecification' :: InputSpecification -> Maybe InputResolution
$sel:maximumBitrate:InputSpecification' :: InputSpecification -> Maybe InputMaximumBitrate
$sel:codec:InputSpecification' :: InputSpecification -> Maybe InputCodec
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe InputCodec
codec
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InputMaximumBitrate
maximumBitrate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InputResolution
resolution

instance Data.ToJSON InputSpecification where
  toJSON :: InputSpecification -> Value
toJSON InputSpecification' {Maybe InputCodec
Maybe InputMaximumBitrate
Maybe InputResolution
resolution :: Maybe InputResolution
maximumBitrate :: Maybe InputMaximumBitrate
codec :: Maybe InputCodec
$sel:resolution:InputSpecification' :: InputSpecification -> Maybe InputResolution
$sel:maximumBitrate:InputSpecification' :: InputSpecification -> Maybe InputMaximumBitrate
$sel:codec:InputSpecification' :: InputSpecification -> Maybe InputCodec
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"codec" 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 InputCodec
codec,
            (Key
"maximumBitrate" 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 InputMaximumBitrate
maximumBitrate,
            (Key
"resolution" 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 InputResolution
resolution
          ]
      )