{-# 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.SavingsPlans.Types.ParentSavingsPlanOffering
-- 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.SavingsPlans.Types.ParentSavingsPlanOffering 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
import Amazonka.SavingsPlans.Types.CurrencyCode
import Amazonka.SavingsPlans.Types.SavingsPlanPaymentOption
import Amazonka.SavingsPlans.Types.SavingsPlanType

-- | Information about a Savings Plan offering.
--
-- /See:/ 'newParentSavingsPlanOffering' smart constructor.
data ParentSavingsPlanOffering = ParentSavingsPlanOffering'
  { -- | The currency.
    ParentSavingsPlanOffering -> Maybe CurrencyCode
currency :: Prelude.Maybe CurrencyCode,
    -- | The duration, in seconds.
    ParentSavingsPlanOffering -> Maybe Natural
durationSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the offering.
    ParentSavingsPlanOffering -> Maybe Text
offeringId :: Prelude.Maybe Prelude.Text,
    -- | The payment option.
    ParentSavingsPlanOffering -> Maybe SavingsPlanPaymentOption
paymentOption :: Prelude.Maybe SavingsPlanPaymentOption,
    -- | The description.
    ParentSavingsPlanOffering -> Maybe Text
planDescription :: Prelude.Maybe Prelude.Text,
    -- | The plan type.
    ParentSavingsPlanOffering -> Maybe SavingsPlanType
planType :: Prelude.Maybe SavingsPlanType
  }
  deriving (ParentSavingsPlanOffering -> ParentSavingsPlanOffering -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParentSavingsPlanOffering -> ParentSavingsPlanOffering -> Bool
$c/= :: ParentSavingsPlanOffering -> ParentSavingsPlanOffering -> Bool
== :: ParentSavingsPlanOffering -> ParentSavingsPlanOffering -> Bool
$c== :: ParentSavingsPlanOffering -> ParentSavingsPlanOffering -> Bool
Prelude.Eq, ReadPrec [ParentSavingsPlanOffering]
ReadPrec ParentSavingsPlanOffering
Int -> ReadS ParentSavingsPlanOffering
ReadS [ParentSavingsPlanOffering]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParentSavingsPlanOffering]
$creadListPrec :: ReadPrec [ParentSavingsPlanOffering]
readPrec :: ReadPrec ParentSavingsPlanOffering
$creadPrec :: ReadPrec ParentSavingsPlanOffering
readList :: ReadS [ParentSavingsPlanOffering]
$creadList :: ReadS [ParentSavingsPlanOffering]
readsPrec :: Int -> ReadS ParentSavingsPlanOffering
$creadsPrec :: Int -> ReadS ParentSavingsPlanOffering
Prelude.Read, Int -> ParentSavingsPlanOffering -> ShowS
[ParentSavingsPlanOffering] -> ShowS
ParentSavingsPlanOffering -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParentSavingsPlanOffering] -> ShowS
$cshowList :: [ParentSavingsPlanOffering] -> ShowS
show :: ParentSavingsPlanOffering -> String
$cshow :: ParentSavingsPlanOffering -> String
showsPrec :: Int -> ParentSavingsPlanOffering -> ShowS
$cshowsPrec :: Int -> ParentSavingsPlanOffering -> ShowS
Prelude.Show, forall x.
Rep ParentSavingsPlanOffering x -> ParentSavingsPlanOffering
forall x.
ParentSavingsPlanOffering -> Rep ParentSavingsPlanOffering x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ParentSavingsPlanOffering x -> ParentSavingsPlanOffering
$cfrom :: forall x.
ParentSavingsPlanOffering -> Rep ParentSavingsPlanOffering x
Prelude.Generic)

-- |
-- Create a value of 'ParentSavingsPlanOffering' 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:
--
-- 'currency', 'parentSavingsPlanOffering_currency' - The currency.
--
-- 'durationSeconds', 'parentSavingsPlanOffering_durationSeconds' - The duration, in seconds.
--
-- 'offeringId', 'parentSavingsPlanOffering_offeringId' - The ID of the offering.
--
-- 'paymentOption', 'parentSavingsPlanOffering_paymentOption' - The payment option.
--
-- 'planDescription', 'parentSavingsPlanOffering_planDescription' - The description.
--
-- 'planType', 'parentSavingsPlanOffering_planType' - The plan type.
newParentSavingsPlanOffering ::
  ParentSavingsPlanOffering
newParentSavingsPlanOffering :: ParentSavingsPlanOffering
newParentSavingsPlanOffering =
  ParentSavingsPlanOffering'
    { $sel:currency:ParentSavingsPlanOffering' :: Maybe CurrencyCode
currency =
        forall a. Maybe a
Prelude.Nothing,
      $sel:durationSeconds:ParentSavingsPlanOffering' :: Maybe Natural
durationSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:offeringId:ParentSavingsPlanOffering' :: Maybe Text
offeringId = forall a. Maybe a
Prelude.Nothing,
      $sel:paymentOption:ParentSavingsPlanOffering' :: Maybe SavingsPlanPaymentOption
paymentOption = forall a. Maybe a
Prelude.Nothing,
      $sel:planDescription:ParentSavingsPlanOffering' :: Maybe Text
planDescription = forall a. Maybe a
Prelude.Nothing,
      $sel:planType:ParentSavingsPlanOffering' :: Maybe SavingsPlanType
planType = forall a. Maybe a
Prelude.Nothing
    }

-- | The currency.
parentSavingsPlanOffering_currency :: Lens.Lens' ParentSavingsPlanOffering (Prelude.Maybe CurrencyCode)
parentSavingsPlanOffering_currency :: Lens' ParentSavingsPlanOffering (Maybe CurrencyCode)
parentSavingsPlanOffering_currency = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParentSavingsPlanOffering' {Maybe CurrencyCode
currency :: Maybe CurrencyCode
$sel:currency:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe CurrencyCode
currency} -> Maybe CurrencyCode
currency) (\s :: ParentSavingsPlanOffering
s@ParentSavingsPlanOffering' {} Maybe CurrencyCode
a -> ParentSavingsPlanOffering
s {$sel:currency:ParentSavingsPlanOffering' :: Maybe CurrencyCode
currency = Maybe CurrencyCode
a} :: ParentSavingsPlanOffering)

-- | The duration, in seconds.
parentSavingsPlanOffering_durationSeconds :: Lens.Lens' ParentSavingsPlanOffering (Prelude.Maybe Prelude.Natural)
parentSavingsPlanOffering_durationSeconds :: Lens' ParentSavingsPlanOffering (Maybe Natural)
parentSavingsPlanOffering_durationSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParentSavingsPlanOffering' {Maybe Natural
durationSeconds :: Maybe Natural
$sel:durationSeconds:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe Natural
durationSeconds} -> Maybe Natural
durationSeconds) (\s :: ParentSavingsPlanOffering
s@ParentSavingsPlanOffering' {} Maybe Natural
a -> ParentSavingsPlanOffering
s {$sel:durationSeconds:ParentSavingsPlanOffering' :: Maybe Natural
durationSeconds = Maybe Natural
a} :: ParentSavingsPlanOffering)

-- | The ID of the offering.
parentSavingsPlanOffering_offeringId :: Lens.Lens' ParentSavingsPlanOffering (Prelude.Maybe Prelude.Text)
parentSavingsPlanOffering_offeringId :: Lens' ParentSavingsPlanOffering (Maybe Text)
parentSavingsPlanOffering_offeringId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParentSavingsPlanOffering' {Maybe Text
offeringId :: Maybe Text
$sel:offeringId:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe Text
offeringId} -> Maybe Text
offeringId) (\s :: ParentSavingsPlanOffering
s@ParentSavingsPlanOffering' {} Maybe Text
a -> ParentSavingsPlanOffering
s {$sel:offeringId:ParentSavingsPlanOffering' :: Maybe Text
offeringId = Maybe Text
a} :: ParentSavingsPlanOffering)

-- | The payment option.
parentSavingsPlanOffering_paymentOption :: Lens.Lens' ParentSavingsPlanOffering (Prelude.Maybe SavingsPlanPaymentOption)
parentSavingsPlanOffering_paymentOption :: Lens' ParentSavingsPlanOffering (Maybe SavingsPlanPaymentOption)
parentSavingsPlanOffering_paymentOption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParentSavingsPlanOffering' {Maybe SavingsPlanPaymentOption
paymentOption :: Maybe SavingsPlanPaymentOption
$sel:paymentOption:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe SavingsPlanPaymentOption
paymentOption} -> Maybe SavingsPlanPaymentOption
paymentOption) (\s :: ParentSavingsPlanOffering
s@ParentSavingsPlanOffering' {} Maybe SavingsPlanPaymentOption
a -> ParentSavingsPlanOffering
s {$sel:paymentOption:ParentSavingsPlanOffering' :: Maybe SavingsPlanPaymentOption
paymentOption = Maybe SavingsPlanPaymentOption
a} :: ParentSavingsPlanOffering)

-- | The description.
parentSavingsPlanOffering_planDescription :: Lens.Lens' ParentSavingsPlanOffering (Prelude.Maybe Prelude.Text)
parentSavingsPlanOffering_planDescription :: Lens' ParentSavingsPlanOffering (Maybe Text)
parentSavingsPlanOffering_planDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParentSavingsPlanOffering' {Maybe Text
planDescription :: Maybe Text
$sel:planDescription:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe Text
planDescription} -> Maybe Text
planDescription) (\s :: ParentSavingsPlanOffering
s@ParentSavingsPlanOffering' {} Maybe Text
a -> ParentSavingsPlanOffering
s {$sel:planDescription:ParentSavingsPlanOffering' :: Maybe Text
planDescription = Maybe Text
a} :: ParentSavingsPlanOffering)

-- | The plan type.
parentSavingsPlanOffering_planType :: Lens.Lens' ParentSavingsPlanOffering (Prelude.Maybe SavingsPlanType)
parentSavingsPlanOffering_planType :: Lens' ParentSavingsPlanOffering (Maybe SavingsPlanType)
parentSavingsPlanOffering_planType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParentSavingsPlanOffering' {Maybe SavingsPlanType
planType :: Maybe SavingsPlanType
$sel:planType:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe SavingsPlanType
planType} -> Maybe SavingsPlanType
planType) (\s :: ParentSavingsPlanOffering
s@ParentSavingsPlanOffering' {} Maybe SavingsPlanType
a -> ParentSavingsPlanOffering
s {$sel:planType:ParentSavingsPlanOffering' :: Maybe SavingsPlanType
planType = Maybe SavingsPlanType
a} :: ParentSavingsPlanOffering)

instance Data.FromJSON ParentSavingsPlanOffering where
  parseJSON :: Value -> Parser ParentSavingsPlanOffering
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ParentSavingsPlanOffering"
      ( \Object
x ->
          Maybe CurrencyCode
-> Maybe Natural
-> Maybe Text
-> Maybe SavingsPlanPaymentOption
-> Maybe Text
-> Maybe SavingsPlanType
-> ParentSavingsPlanOffering
ParentSavingsPlanOffering'
            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
"currency")
            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
"durationSeconds")
            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
"offeringId")
            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
"paymentOption")
            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
"planDescription")
            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
"planType")
      )

instance Prelude.Hashable ParentSavingsPlanOffering where
  hashWithSalt :: Int -> ParentSavingsPlanOffering -> Int
hashWithSalt Int
_salt ParentSavingsPlanOffering' {Maybe Natural
Maybe Text
Maybe CurrencyCode
Maybe SavingsPlanPaymentOption
Maybe SavingsPlanType
planType :: Maybe SavingsPlanType
planDescription :: Maybe Text
paymentOption :: Maybe SavingsPlanPaymentOption
offeringId :: Maybe Text
durationSeconds :: Maybe Natural
currency :: Maybe CurrencyCode
$sel:planType:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe SavingsPlanType
$sel:planDescription:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe Text
$sel:paymentOption:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe SavingsPlanPaymentOption
$sel:offeringId:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe Text
$sel:durationSeconds:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe Natural
$sel:currency:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe CurrencyCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CurrencyCode
currency
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
durationSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
offeringId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SavingsPlanPaymentOption
paymentOption
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
planDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SavingsPlanType
planType

instance Prelude.NFData ParentSavingsPlanOffering where
  rnf :: ParentSavingsPlanOffering -> ()
rnf ParentSavingsPlanOffering' {Maybe Natural
Maybe Text
Maybe CurrencyCode
Maybe SavingsPlanPaymentOption
Maybe SavingsPlanType
planType :: Maybe SavingsPlanType
planDescription :: Maybe Text
paymentOption :: Maybe SavingsPlanPaymentOption
offeringId :: Maybe Text
durationSeconds :: Maybe Natural
currency :: Maybe CurrencyCode
$sel:planType:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe SavingsPlanType
$sel:planDescription:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe Text
$sel:paymentOption:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe SavingsPlanPaymentOption
$sel:offeringId:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe Text
$sel:durationSeconds:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe Natural
$sel:currency:ParentSavingsPlanOffering' :: ParentSavingsPlanOffering -> Maybe CurrencyCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CurrencyCode
currency
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
durationSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
offeringId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SavingsPlanPaymentOption
paymentOption
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
planDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SavingsPlanType
planType