{-# 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-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.SavingsPlans.Types.ParentSavingsPlanOffering where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 description.
    ParentSavingsPlanOffering -> Maybe Text
planDescription :: Prelude.Maybe Prelude.Text,
    -- | The plan type.
    ParentSavingsPlanOffering -> Maybe SavingsPlanType
planType :: Prelude.Maybe SavingsPlanType,
    -- | The payment option.
    ParentSavingsPlanOffering -> Maybe SavingsPlanPaymentOption
paymentOption :: Prelude.Maybe SavingsPlanPaymentOption
  }
  deriving (ParentSavingsPlanOffering -> ParentSavingsPlanOffering -> Bool
(ParentSavingsPlanOffering -> ParentSavingsPlanOffering -> Bool)
-> (ParentSavingsPlanOffering -> ParentSavingsPlanOffering -> Bool)
-> Eq ParentSavingsPlanOffering
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]
(Int -> ReadS ParentSavingsPlanOffering)
-> ReadS [ParentSavingsPlanOffering]
-> ReadPrec ParentSavingsPlanOffering
-> ReadPrec [ParentSavingsPlanOffering]
-> Read 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
(Int -> ParentSavingsPlanOffering -> ShowS)
-> (ParentSavingsPlanOffering -> String)
-> ([ParentSavingsPlanOffering] -> ShowS)
-> Show ParentSavingsPlanOffering
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.
 ParentSavingsPlanOffering -> Rep ParentSavingsPlanOffering x)
-> (forall x.
    Rep ParentSavingsPlanOffering x -> ParentSavingsPlanOffering)
-> Generic ParentSavingsPlanOffering
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.
--
-- 'planDescription', 'parentSavingsPlanOffering_planDescription' - The description.
--
-- 'planType', 'parentSavingsPlanOffering_planType' - The plan type.
--
-- 'paymentOption', 'parentSavingsPlanOffering_paymentOption' - The payment option.
newParentSavingsPlanOffering ::
  ParentSavingsPlanOffering
newParentSavingsPlanOffering :: ParentSavingsPlanOffering
newParentSavingsPlanOffering =
  ParentSavingsPlanOffering' :: Maybe CurrencyCode
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe SavingsPlanType
-> Maybe SavingsPlanPaymentOption
-> ParentSavingsPlanOffering
ParentSavingsPlanOffering'
    { $sel:currency:ParentSavingsPlanOffering' :: Maybe CurrencyCode
currency =
        Maybe CurrencyCode
forall a. Maybe a
Prelude.Nothing,
      $sel:durationSeconds:ParentSavingsPlanOffering' :: Maybe Natural
durationSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:offeringId:ParentSavingsPlanOffering' :: Maybe Text
offeringId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:planDescription:ParentSavingsPlanOffering' :: Maybe Text
planDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:planType:ParentSavingsPlanOffering' :: Maybe SavingsPlanType
planType = Maybe SavingsPlanType
forall a. Maybe a
Prelude.Nothing,
      $sel:paymentOption:ParentSavingsPlanOffering' :: Maybe SavingsPlanPaymentOption
paymentOption = Maybe SavingsPlanPaymentOption
forall a. Maybe a
Prelude.Nothing
    }

-- | The currency.
parentSavingsPlanOffering_currency :: Lens.Lens' ParentSavingsPlanOffering (Prelude.Maybe CurrencyCode)
parentSavingsPlanOffering_currency :: (Maybe CurrencyCode -> f (Maybe CurrencyCode))
-> ParentSavingsPlanOffering -> f ParentSavingsPlanOffering
parentSavingsPlanOffering_currency = (ParentSavingsPlanOffering -> Maybe CurrencyCode)
-> (ParentSavingsPlanOffering
    -> Maybe CurrencyCode -> ParentSavingsPlanOffering)
-> Lens
     ParentSavingsPlanOffering
     ParentSavingsPlanOffering
     (Maybe CurrencyCode)
     (Maybe CurrencyCode)
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 :: (Maybe Natural -> f (Maybe Natural))
-> ParentSavingsPlanOffering -> f ParentSavingsPlanOffering
parentSavingsPlanOffering_durationSeconds = (ParentSavingsPlanOffering -> Maybe Natural)
-> (ParentSavingsPlanOffering
    -> Maybe Natural -> ParentSavingsPlanOffering)
-> Lens
     ParentSavingsPlanOffering
     ParentSavingsPlanOffering
     (Maybe Natural)
     (Maybe Natural)
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 :: (Maybe Text -> f (Maybe Text))
-> ParentSavingsPlanOffering -> f ParentSavingsPlanOffering
parentSavingsPlanOffering_offeringId = (ParentSavingsPlanOffering -> Maybe Text)
-> (ParentSavingsPlanOffering
    -> Maybe Text -> ParentSavingsPlanOffering)
-> Lens
     ParentSavingsPlanOffering
     ParentSavingsPlanOffering
     (Maybe Text)
     (Maybe Text)
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 description.
parentSavingsPlanOffering_planDescription :: Lens.Lens' ParentSavingsPlanOffering (Prelude.Maybe Prelude.Text)
parentSavingsPlanOffering_planDescription :: (Maybe Text -> f (Maybe Text))
-> ParentSavingsPlanOffering -> f ParentSavingsPlanOffering
parentSavingsPlanOffering_planDescription = (ParentSavingsPlanOffering -> Maybe Text)
-> (ParentSavingsPlanOffering
    -> Maybe Text -> ParentSavingsPlanOffering)
-> Lens
     ParentSavingsPlanOffering
     ParentSavingsPlanOffering
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe SavingsPlanType -> f (Maybe SavingsPlanType))
-> ParentSavingsPlanOffering -> f ParentSavingsPlanOffering
parentSavingsPlanOffering_planType = (ParentSavingsPlanOffering -> Maybe SavingsPlanType)
-> (ParentSavingsPlanOffering
    -> Maybe SavingsPlanType -> ParentSavingsPlanOffering)
-> Lens
     ParentSavingsPlanOffering
     ParentSavingsPlanOffering
     (Maybe SavingsPlanType)
     (Maybe SavingsPlanType)
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)

-- | The payment option.
parentSavingsPlanOffering_paymentOption :: Lens.Lens' ParentSavingsPlanOffering (Prelude.Maybe SavingsPlanPaymentOption)
parentSavingsPlanOffering_paymentOption :: (Maybe SavingsPlanPaymentOption
 -> f (Maybe SavingsPlanPaymentOption))
-> ParentSavingsPlanOffering -> f ParentSavingsPlanOffering
parentSavingsPlanOffering_paymentOption = (ParentSavingsPlanOffering -> Maybe SavingsPlanPaymentOption)
-> (ParentSavingsPlanOffering
    -> Maybe SavingsPlanPaymentOption -> ParentSavingsPlanOffering)
-> Lens
     ParentSavingsPlanOffering
     ParentSavingsPlanOffering
     (Maybe SavingsPlanPaymentOption)
     (Maybe SavingsPlanPaymentOption)
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)

instance Core.FromJSON ParentSavingsPlanOffering where
  parseJSON :: Value -> Parser ParentSavingsPlanOffering
parseJSON =
    String
-> (Object -> Parser ParentSavingsPlanOffering)
-> Value
-> Parser ParentSavingsPlanOffering
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ParentSavingsPlanOffering"
      ( \Object
x ->
          Maybe CurrencyCode
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe SavingsPlanType
-> Maybe SavingsPlanPaymentOption
-> ParentSavingsPlanOffering
ParentSavingsPlanOffering'
            (Maybe CurrencyCode
 -> Maybe Natural
 -> Maybe Text
 -> Maybe Text
 -> Maybe SavingsPlanType
 -> Maybe SavingsPlanPaymentOption
 -> ParentSavingsPlanOffering)
-> Parser (Maybe CurrencyCode)
-> Parser
     (Maybe Natural
      -> Maybe Text
      -> Maybe Text
      -> Maybe SavingsPlanType
      -> Maybe SavingsPlanPaymentOption
      -> ParentSavingsPlanOffering)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CurrencyCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"currency")
            Parser
  (Maybe Natural
   -> Maybe Text
   -> Maybe Text
   -> Maybe SavingsPlanType
   -> Maybe SavingsPlanPaymentOption
   -> ParentSavingsPlanOffering)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe SavingsPlanType
      -> Maybe SavingsPlanPaymentOption
      -> ParentSavingsPlanOffering)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"durationSeconds")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe SavingsPlanType
   -> Maybe SavingsPlanPaymentOption
   -> ParentSavingsPlanOffering)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe SavingsPlanType
      -> Maybe SavingsPlanPaymentOption
      -> ParentSavingsPlanOffering)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"offeringId")
            Parser
  (Maybe Text
   -> Maybe SavingsPlanType
   -> Maybe SavingsPlanPaymentOption
   -> ParentSavingsPlanOffering)
-> Parser (Maybe Text)
-> Parser
     (Maybe SavingsPlanType
      -> Maybe SavingsPlanPaymentOption -> ParentSavingsPlanOffering)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"planDescription")
            Parser
  (Maybe SavingsPlanType
   -> Maybe SavingsPlanPaymentOption -> ParentSavingsPlanOffering)
-> Parser (Maybe SavingsPlanType)
-> Parser
     (Maybe SavingsPlanPaymentOption -> ParentSavingsPlanOffering)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SavingsPlanType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"planType")
            Parser
  (Maybe SavingsPlanPaymentOption -> ParentSavingsPlanOffering)
-> Parser (Maybe SavingsPlanPaymentOption)
-> Parser ParentSavingsPlanOffering
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SavingsPlanPaymentOption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"paymentOption")
      )

instance Prelude.Hashable ParentSavingsPlanOffering

instance Prelude.NFData ParentSavingsPlanOffering