{-# 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.CdiInputSpecification
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.CdiInputSpecification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.CdiInputResolution
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'CdiInputSpecification' 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:
--
-- 'resolution', 'cdiInputSpecification_resolution' - Maximum CDI input resolution
newCdiInputSpecification ::
  CdiInputSpecification
newCdiInputSpecification :: CdiInputSpecification
newCdiInputSpecification =
  CdiInputSpecification' :: Maybe CdiInputResolution -> CdiInputSpecification
CdiInputSpecification'
    { $sel:resolution:CdiInputSpecification' :: Maybe CdiInputResolution
resolution =
        Maybe CdiInputResolution
forall a. Maybe a
Prelude.Nothing
    }

-- | Maximum CDI input resolution
cdiInputSpecification_resolution :: Lens.Lens' CdiInputSpecification (Prelude.Maybe CdiInputResolution)
cdiInputSpecification_resolution :: (Maybe CdiInputResolution -> f (Maybe CdiInputResolution))
-> CdiInputSpecification -> f CdiInputSpecification
cdiInputSpecification_resolution = (CdiInputSpecification -> Maybe CdiInputResolution)
-> (CdiInputSpecification
    -> Maybe CdiInputResolution -> CdiInputSpecification)
-> Lens
     CdiInputSpecification
     CdiInputSpecification
     (Maybe CdiInputResolution)
     (Maybe CdiInputResolution)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CdiInputSpecification' {Maybe CdiInputResolution
resolution :: Maybe CdiInputResolution
$sel:resolution:CdiInputSpecification' :: CdiInputSpecification -> Maybe CdiInputResolution
resolution} -> Maybe CdiInputResolution
resolution) (\s :: CdiInputSpecification
s@CdiInputSpecification' {} Maybe CdiInputResolution
a -> CdiInputSpecification
s {$sel:resolution:CdiInputSpecification' :: Maybe CdiInputResolution
resolution = Maybe CdiInputResolution
a} :: CdiInputSpecification)

instance Core.FromJSON CdiInputSpecification where
  parseJSON :: Value -> Parser CdiInputSpecification
parseJSON =
    String
-> (Object -> Parser CdiInputSpecification)
-> Value
-> Parser CdiInputSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CdiInputSpecification"
      ( \Object
x ->
          Maybe CdiInputResolution -> CdiInputSpecification
CdiInputSpecification'
            (Maybe CdiInputResolution -> CdiInputSpecification)
-> Parser (Maybe CdiInputResolution)
-> Parser CdiInputSpecification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CdiInputResolution)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resolution")
      )

instance Prelude.Hashable CdiInputSpecification

instance Prelude.NFData CdiInputSpecification

instance Core.ToJSON CdiInputSpecification where
  toJSON :: CdiInputSpecification -> Value
toJSON CdiInputSpecification' {Maybe CdiInputResolution
resolution :: Maybe CdiInputResolution
$sel:resolution:CdiInputSpecification' :: CdiInputSpecification -> Maybe CdiInputResolution
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"resolution" Text -> CdiInputResolution -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CdiInputResolution -> Pair)
-> Maybe CdiInputResolution -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CdiInputResolution
resolution]
      )