{-# 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.MediaConnect.Types.ResourceSpecification
-- 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.MediaConnect.Types.ResourceSpecification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaConnect.Types.ResourceType
import qualified Amazonka.Prelude as Prelude

-- | A definition of what is being billed for, including the type and amount.
--
-- /See:/ 'newResourceSpecification' smart constructor.
data ResourceSpecification = ResourceSpecification'
  { -- | The amount of outbound bandwidth that is discounted in the offering.
    ResourceSpecification -> Maybe Int
reservedBitrate :: Prelude.Maybe Prelude.Int,
    -- | The type of resource and the unit that is being billed for.
    ResourceSpecification -> ResourceType
resourceType :: ResourceType
  }
  deriving (ResourceSpecification -> ResourceSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceSpecification -> ResourceSpecification -> Bool
$c/= :: ResourceSpecification -> ResourceSpecification -> Bool
== :: ResourceSpecification -> ResourceSpecification -> Bool
$c== :: ResourceSpecification -> ResourceSpecification -> Bool
Prelude.Eq, ReadPrec [ResourceSpecification]
ReadPrec ResourceSpecification
Int -> ReadS ResourceSpecification
ReadS [ResourceSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceSpecification]
$creadListPrec :: ReadPrec [ResourceSpecification]
readPrec :: ReadPrec ResourceSpecification
$creadPrec :: ReadPrec ResourceSpecification
readList :: ReadS [ResourceSpecification]
$creadList :: ReadS [ResourceSpecification]
readsPrec :: Int -> ReadS ResourceSpecification
$creadsPrec :: Int -> ReadS ResourceSpecification
Prelude.Read, Int -> ResourceSpecification -> ShowS
[ResourceSpecification] -> ShowS
ResourceSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceSpecification] -> ShowS
$cshowList :: [ResourceSpecification] -> ShowS
show :: ResourceSpecification -> String
$cshow :: ResourceSpecification -> String
showsPrec :: Int -> ResourceSpecification -> ShowS
$cshowsPrec :: Int -> ResourceSpecification -> ShowS
Prelude.Show, forall x. Rep ResourceSpecification x -> ResourceSpecification
forall x. ResourceSpecification -> Rep ResourceSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceSpecification x -> ResourceSpecification
$cfrom :: forall x. ResourceSpecification -> Rep ResourceSpecification x
Prelude.Generic)

-- |
-- Create a value of 'ResourceSpecification' 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:
--
-- 'reservedBitrate', 'resourceSpecification_reservedBitrate' - The amount of outbound bandwidth that is discounted in the offering.
--
-- 'resourceType', 'resourceSpecification_resourceType' - The type of resource and the unit that is being billed for.
newResourceSpecification ::
  -- | 'resourceType'
  ResourceType ->
  ResourceSpecification
newResourceSpecification :: ResourceType -> ResourceSpecification
newResourceSpecification ResourceType
pResourceType_ =
  ResourceSpecification'
    { $sel:reservedBitrate:ResourceSpecification' :: Maybe Int
reservedBitrate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ResourceSpecification' :: ResourceType
resourceType = ResourceType
pResourceType_
    }

-- | The amount of outbound bandwidth that is discounted in the offering.
resourceSpecification_reservedBitrate :: Lens.Lens' ResourceSpecification (Prelude.Maybe Prelude.Int)
resourceSpecification_reservedBitrate :: Lens' ResourceSpecification (Maybe Int)
resourceSpecification_reservedBitrate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSpecification' {Maybe Int
reservedBitrate :: Maybe Int
$sel:reservedBitrate:ResourceSpecification' :: ResourceSpecification -> Maybe Int
reservedBitrate} -> Maybe Int
reservedBitrate) (\s :: ResourceSpecification
s@ResourceSpecification' {} Maybe Int
a -> ResourceSpecification
s {$sel:reservedBitrate:ResourceSpecification' :: Maybe Int
reservedBitrate = Maybe Int
a} :: ResourceSpecification)

-- | The type of resource and the unit that is being billed for.
resourceSpecification_resourceType :: Lens.Lens' ResourceSpecification ResourceType
resourceSpecification_resourceType :: Lens' ResourceSpecification ResourceType
resourceSpecification_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSpecification' {ResourceType
resourceType :: ResourceType
$sel:resourceType:ResourceSpecification' :: ResourceSpecification -> ResourceType
resourceType} -> ResourceType
resourceType) (\s :: ResourceSpecification
s@ResourceSpecification' {} ResourceType
a -> ResourceSpecification
s {$sel:resourceType:ResourceSpecification' :: ResourceType
resourceType = ResourceType
a} :: ResourceSpecification)

instance Data.FromJSON ResourceSpecification where
  parseJSON :: Value -> Parser ResourceSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResourceSpecification"
      ( \Object
x ->
          Maybe Int -> ResourceType -> ResourceSpecification
ResourceSpecification'
            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
"reservedBitrate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"resourceType")
      )

instance Prelude.Hashable ResourceSpecification where
  hashWithSalt :: Int -> ResourceSpecification -> Int
hashWithSalt Int
_salt ResourceSpecification' {Maybe Int
ResourceType
resourceType :: ResourceType
reservedBitrate :: Maybe Int
$sel:resourceType:ResourceSpecification' :: ResourceSpecification -> ResourceType
$sel:reservedBitrate:ResourceSpecification' :: ResourceSpecification -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
reservedBitrate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceType
resourceType

instance Prelude.NFData ResourceSpecification where
  rnf :: ResourceSpecification -> ()
rnf ResourceSpecification' {Maybe Int
ResourceType
resourceType :: ResourceType
reservedBitrate :: Maybe Int
$sel:resourceType:ResourceSpecification' :: ResourceSpecification -> ResourceType
$sel:reservedBitrate:ResourceSpecification' :: ResourceSpecification -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
reservedBitrate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceType
resourceType