{-# 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.Offering
-- 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.Offering 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.DurationUnits
import Amazonka.MediaConnect.Types.PriceUnits
import Amazonka.MediaConnect.Types.ResourceSpecification
import qualified Amazonka.Prelude as Prelude

-- | A savings plan that reserves a certain amount of outbound bandwidth
-- usage at a discounted rate each month over a period of time.
--
-- /See:/ 'newOffering' smart constructor.
data Offering = Offering'
  { -- | The type of currency that is used for billing. The currencyCode used for
    -- all reservations is US dollars.
    Offering -> Text
currencyCode :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) that MediaConnect assigns to the
    -- offering.
    Offering -> Text
offeringArn :: Prelude.Text,
    -- | A description of the offering.
    Offering -> Text
offeringDescription :: Prelude.Text,
    -- | The unit of measurement for the duration of the offering.
    Offering -> DurationUnits
durationUnits :: DurationUnits,
    -- | The length of time that your reservation would be active.
    Offering -> Int
duration :: Prelude.Int,
    -- | The cost of a single unit. This value, in combination with priceUnits,
    -- makes up the rate.
    Offering -> Text
pricePerUnit :: Prelude.Text,
    -- | A definition of the amount of outbound bandwidth that you would be
    -- reserving if you purchase the offering.
    Offering -> ResourceSpecification
resourceSpecification :: ResourceSpecification,
    -- | The unit of measurement that is used for billing. This value, in
    -- combination with pricePerUnit, makes up the rate.
    Offering -> PriceUnits
priceUnits :: PriceUnits
  }
  deriving (Offering -> Offering -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Offering -> Offering -> Bool
$c/= :: Offering -> Offering -> Bool
== :: Offering -> Offering -> Bool
$c== :: Offering -> Offering -> Bool
Prelude.Eq, ReadPrec [Offering]
ReadPrec Offering
Int -> ReadS Offering
ReadS [Offering]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Offering]
$creadListPrec :: ReadPrec [Offering]
readPrec :: ReadPrec Offering
$creadPrec :: ReadPrec Offering
readList :: ReadS [Offering]
$creadList :: ReadS [Offering]
readsPrec :: Int -> ReadS Offering
$creadsPrec :: Int -> ReadS Offering
Prelude.Read, Int -> Offering -> ShowS
[Offering] -> ShowS
Offering -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Offering] -> ShowS
$cshowList :: [Offering] -> ShowS
show :: Offering -> String
$cshow :: Offering -> String
showsPrec :: Int -> Offering -> ShowS
$cshowsPrec :: Int -> Offering -> ShowS
Prelude.Show, forall x. Rep Offering x -> Offering
forall x. Offering -> Rep Offering x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Offering x -> Offering
$cfrom :: forall x. Offering -> Rep Offering x
Prelude.Generic)

-- |
-- Create a value of 'Offering' 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:
--
-- 'currencyCode', 'offering_currencyCode' - The type of currency that is used for billing. The currencyCode used for
-- all reservations is US dollars.
--
-- 'offeringArn', 'offering_offeringArn' - The Amazon Resource Name (ARN) that MediaConnect assigns to the
-- offering.
--
-- 'offeringDescription', 'offering_offeringDescription' - A description of the offering.
--
-- 'durationUnits', 'offering_durationUnits' - The unit of measurement for the duration of the offering.
--
-- 'duration', 'offering_duration' - The length of time that your reservation would be active.
--
-- 'pricePerUnit', 'offering_pricePerUnit' - The cost of a single unit. This value, in combination with priceUnits,
-- makes up the rate.
--
-- 'resourceSpecification', 'offering_resourceSpecification' - A definition of the amount of outbound bandwidth that you would be
-- reserving if you purchase the offering.
--
-- 'priceUnits', 'offering_priceUnits' - The unit of measurement that is used for billing. This value, in
-- combination with pricePerUnit, makes up the rate.
newOffering ::
  -- | 'currencyCode'
  Prelude.Text ->
  -- | 'offeringArn'
  Prelude.Text ->
  -- | 'offeringDescription'
  Prelude.Text ->
  -- | 'durationUnits'
  DurationUnits ->
  -- | 'duration'
  Prelude.Int ->
  -- | 'pricePerUnit'
  Prelude.Text ->
  -- | 'resourceSpecification'
  ResourceSpecification ->
  -- | 'priceUnits'
  PriceUnits ->
  Offering
newOffering :: Text
-> Text
-> Text
-> DurationUnits
-> Int
-> Text
-> ResourceSpecification
-> PriceUnits
-> Offering
newOffering
  Text
pCurrencyCode_
  Text
pOfferingArn_
  Text
pOfferingDescription_
  DurationUnits
pDurationUnits_
  Int
pDuration_
  Text
pPricePerUnit_
  ResourceSpecification
pResourceSpecification_
  PriceUnits
pPriceUnits_ =
    Offering'
      { $sel:currencyCode:Offering' :: Text
currencyCode = Text
pCurrencyCode_,
        $sel:offeringArn:Offering' :: Text
offeringArn = Text
pOfferingArn_,
        $sel:offeringDescription:Offering' :: Text
offeringDescription = Text
pOfferingDescription_,
        $sel:durationUnits:Offering' :: DurationUnits
durationUnits = DurationUnits
pDurationUnits_,
        $sel:duration:Offering' :: Int
duration = Int
pDuration_,
        $sel:pricePerUnit:Offering' :: Text
pricePerUnit = Text
pPricePerUnit_,
        $sel:resourceSpecification:Offering' :: ResourceSpecification
resourceSpecification = ResourceSpecification
pResourceSpecification_,
        $sel:priceUnits:Offering' :: PriceUnits
priceUnits = PriceUnits
pPriceUnits_
      }

-- | The type of currency that is used for billing. The currencyCode used for
-- all reservations is US dollars.
offering_currencyCode :: Lens.Lens' Offering Prelude.Text
offering_currencyCode :: Lens' Offering Text
offering_currencyCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Text
currencyCode :: Text
$sel:currencyCode:Offering' :: Offering -> Text
currencyCode} -> Text
currencyCode) (\s :: Offering
s@Offering' {} Text
a -> Offering
s {$sel:currencyCode:Offering' :: Text
currencyCode = Text
a} :: Offering)

-- | The Amazon Resource Name (ARN) that MediaConnect assigns to the
-- offering.
offering_offeringArn :: Lens.Lens' Offering Prelude.Text
offering_offeringArn :: Lens' Offering Text
offering_offeringArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Text
offeringArn :: Text
$sel:offeringArn:Offering' :: Offering -> Text
offeringArn} -> Text
offeringArn) (\s :: Offering
s@Offering' {} Text
a -> Offering
s {$sel:offeringArn:Offering' :: Text
offeringArn = Text
a} :: Offering)

-- | A description of the offering.
offering_offeringDescription :: Lens.Lens' Offering Prelude.Text
offering_offeringDescription :: Lens' Offering Text
offering_offeringDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Text
offeringDescription :: Text
$sel:offeringDescription:Offering' :: Offering -> Text
offeringDescription} -> Text
offeringDescription) (\s :: Offering
s@Offering' {} Text
a -> Offering
s {$sel:offeringDescription:Offering' :: Text
offeringDescription = Text
a} :: Offering)

-- | The unit of measurement for the duration of the offering.
offering_durationUnits :: Lens.Lens' Offering DurationUnits
offering_durationUnits :: Lens' Offering DurationUnits
offering_durationUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {DurationUnits
durationUnits :: DurationUnits
$sel:durationUnits:Offering' :: Offering -> DurationUnits
durationUnits} -> DurationUnits
durationUnits) (\s :: Offering
s@Offering' {} DurationUnits
a -> Offering
s {$sel:durationUnits:Offering' :: DurationUnits
durationUnits = DurationUnits
a} :: Offering)

-- | The length of time that your reservation would be active.
offering_duration :: Lens.Lens' Offering Prelude.Int
offering_duration :: Lens' Offering Int
offering_duration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Int
duration :: Int
$sel:duration:Offering' :: Offering -> Int
duration} -> Int
duration) (\s :: Offering
s@Offering' {} Int
a -> Offering
s {$sel:duration:Offering' :: Int
duration = Int
a} :: Offering)

-- | The cost of a single unit. This value, in combination with priceUnits,
-- makes up the rate.
offering_pricePerUnit :: Lens.Lens' Offering Prelude.Text
offering_pricePerUnit :: Lens' Offering Text
offering_pricePerUnit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Text
pricePerUnit :: Text
$sel:pricePerUnit:Offering' :: Offering -> Text
pricePerUnit} -> Text
pricePerUnit) (\s :: Offering
s@Offering' {} Text
a -> Offering
s {$sel:pricePerUnit:Offering' :: Text
pricePerUnit = Text
a} :: Offering)

-- | A definition of the amount of outbound bandwidth that you would be
-- reserving if you purchase the offering.
offering_resourceSpecification :: Lens.Lens' Offering ResourceSpecification
offering_resourceSpecification :: Lens' Offering ResourceSpecification
offering_resourceSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {ResourceSpecification
resourceSpecification :: ResourceSpecification
$sel:resourceSpecification:Offering' :: Offering -> ResourceSpecification
resourceSpecification} -> ResourceSpecification
resourceSpecification) (\s :: Offering
s@Offering' {} ResourceSpecification
a -> Offering
s {$sel:resourceSpecification:Offering' :: ResourceSpecification
resourceSpecification = ResourceSpecification
a} :: Offering)

-- | The unit of measurement that is used for billing. This value, in
-- combination with pricePerUnit, makes up the rate.
offering_priceUnits :: Lens.Lens' Offering PriceUnits
offering_priceUnits :: Lens' Offering PriceUnits
offering_priceUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {PriceUnits
priceUnits :: PriceUnits
$sel:priceUnits:Offering' :: Offering -> PriceUnits
priceUnits} -> PriceUnits
priceUnits) (\s :: Offering
s@Offering' {} PriceUnits
a -> Offering
s {$sel:priceUnits:Offering' :: PriceUnits
priceUnits = PriceUnits
a} :: Offering)

instance Data.FromJSON Offering where
  parseJSON :: Value -> Parser Offering
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Offering"
      ( \Object
x ->
          Text
-> Text
-> Text
-> DurationUnits
-> Int
-> Text
-> ResourceSpecification
-> PriceUnits
-> Offering
Offering'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"currencyCode")
            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
"offeringArn")
            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
"offeringDescription")
            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
"durationUnits")
            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
"duration")
            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
"pricePerUnit")
            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
"resourceSpecification")
            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
"priceUnits")
      )

instance Prelude.Hashable Offering where
  hashWithSalt :: Int -> Offering -> Int
hashWithSalt Int
_salt Offering' {Int
Text
DurationUnits
PriceUnits
ResourceSpecification
priceUnits :: PriceUnits
resourceSpecification :: ResourceSpecification
pricePerUnit :: Text
duration :: Int
durationUnits :: DurationUnits
offeringDescription :: Text
offeringArn :: Text
currencyCode :: Text
$sel:priceUnits:Offering' :: Offering -> PriceUnits
$sel:resourceSpecification:Offering' :: Offering -> ResourceSpecification
$sel:pricePerUnit:Offering' :: Offering -> Text
$sel:duration:Offering' :: Offering -> Int
$sel:durationUnits:Offering' :: Offering -> DurationUnits
$sel:offeringDescription:Offering' :: Offering -> Text
$sel:offeringArn:Offering' :: Offering -> Text
$sel:currencyCode:Offering' :: Offering -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
currencyCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
offeringArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
offeringDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DurationUnits
durationUnits
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
duration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
pricePerUnit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceSpecification
resourceSpecification
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PriceUnits
priceUnits

instance Prelude.NFData Offering where
  rnf :: Offering -> ()
rnf Offering' {Int
Text
DurationUnits
PriceUnits
ResourceSpecification
priceUnits :: PriceUnits
resourceSpecification :: ResourceSpecification
pricePerUnit :: Text
duration :: Int
durationUnits :: DurationUnits
offeringDescription :: Text
offeringArn :: Text
currencyCode :: Text
$sel:priceUnits:Offering' :: Offering -> PriceUnits
$sel:resourceSpecification:Offering' :: Offering -> ResourceSpecification
$sel:pricePerUnit:Offering' :: Offering -> Text
$sel:duration:Offering' :: Offering -> Int
$sel:durationUnits:Offering' :: Offering -> DurationUnits
$sel:offeringDescription:Offering' :: Offering -> Text
$sel:offeringArn:Offering' :: Offering -> Text
$sel:currencyCode:Offering' :: Offering -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
currencyCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
offeringArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
offeringDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DurationUnits
durationUnits
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
duration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
pricePerUnit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceSpecification
resourceSpecification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PriceUnits
priceUnits