{-# 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.SavingsPlanRate
-- 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.SavingsPlanRate 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.SavingsPlanProductType
import Amazonka.SavingsPlans.Types.SavingsPlanRateProperty
import Amazonka.SavingsPlans.Types.SavingsPlanRateServiceCode
import Amazonka.SavingsPlans.Types.SavingsPlanRateUnit

-- | Information about a Savings Plan rate.
--
-- /See:/ 'newSavingsPlanRate' smart constructor.
data SavingsPlanRate = SavingsPlanRate'
  { -- | The specific AWS operation for the line item in the billing report.
    SavingsPlanRate -> Maybe Text
operation :: Prelude.Maybe Prelude.Text,
    -- | The usage details of the line item in the billing report.
    SavingsPlanRate -> Maybe Text
usageType :: Prelude.Maybe Prelude.Text,
    -- | The product type.
    SavingsPlanRate -> Maybe SavingsPlanProductType
productType :: Prelude.Maybe SavingsPlanProductType,
    -- | The currency.
    SavingsPlanRate -> Maybe CurrencyCode
currency :: Prelude.Maybe CurrencyCode,
    -- | The rate.
    SavingsPlanRate -> Maybe Text
rate :: Prelude.Maybe Prelude.Text,
    -- | The service.
    SavingsPlanRate -> Maybe SavingsPlanRateServiceCode
serviceCode :: Prelude.Maybe SavingsPlanRateServiceCode,
    -- | The unit.
    SavingsPlanRate -> Maybe SavingsPlanRateUnit
unit :: Prelude.Maybe SavingsPlanRateUnit,
    -- | The properties.
    SavingsPlanRate -> Maybe [SavingsPlanRateProperty]
properties :: Prelude.Maybe [SavingsPlanRateProperty]
  }
  deriving (SavingsPlanRate -> SavingsPlanRate -> Bool
(SavingsPlanRate -> SavingsPlanRate -> Bool)
-> (SavingsPlanRate -> SavingsPlanRate -> Bool)
-> Eq SavingsPlanRate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SavingsPlanRate -> SavingsPlanRate -> Bool
$c/= :: SavingsPlanRate -> SavingsPlanRate -> Bool
== :: SavingsPlanRate -> SavingsPlanRate -> Bool
$c== :: SavingsPlanRate -> SavingsPlanRate -> Bool
Prelude.Eq, ReadPrec [SavingsPlanRate]
ReadPrec SavingsPlanRate
Int -> ReadS SavingsPlanRate
ReadS [SavingsPlanRate]
(Int -> ReadS SavingsPlanRate)
-> ReadS [SavingsPlanRate]
-> ReadPrec SavingsPlanRate
-> ReadPrec [SavingsPlanRate]
-> Read SavingsPlanRate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SavingsPlanRate]
$creadListPrec :: ReadPrec [SavingsPlanRate]
readPrec :: ReadPrec SavingsPlanRate
$creadPrec :: ReadPrec SavingsPlanRate
readList :: ReadS [SavingsPlanRate]
$creadList :: ReadS [SavingsPlanRate]
readsPrec :: Int -> ReadS SavingsPlanRate
$creadsPrec :: Int -> ReadS SavingsPlanRate
Prelude.Read, Int -> SavingsPlanRate -> ShowS
[SavingsPlanRate] -> ShowS
SavingsPlanRate -> String
(Int -> SavingsPlanRate -> ShowS)
-> (SavingsPlanRate -> String)
-> ([SavingsPlanRate] -> ShowS)
-> Show SavingsPlanRate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SavingsPlanRate] -> ShowS
$cshowList :: [SavingsPlanRate] -> ShowS
show :: SavingsPlanRate -> String
$cshow :: SavingsPlanRate -> String
showsPrec :: Int -> SavingsPlanRate -> ShowS
$cshowsPrec :: Int -> SavingsPlanRate -> ShowS
Prelude.Show, (forall x. SavingsPlanRate -> Rep SavingsPlanRate x)
-> (forall x. Rep SavingsPlanRate x -> SavingsPlanRate)
-> Generic SavingsPlanRate
forall x. Rep SavingsPlanRate x -> SavingsPlanRate
forall x. SavingsPlanRate -> Rep SavingsPlanRate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SavingsPlanRate x -> SavingsPlanRate
$cfrom :: forall x. SavingsPlanRate -> Rep SavingsPlanRate x
Prelude.Generic)

-- |
-- Create a value of 'SavingsPlanRate' 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:
--
-- 'operation', 'savingsPlanRate_operation' - The specific AWS operation for the line item in the billing report.
--
-- 'usageType', 'savingsPlanRate_usageType' - The usage details of the line item in the billing report.
--
-- 'productType', 'savingsPlanRate_productType' - The product type.
--
-- 'currency', 'savingsPlanRate_currency' - The currency.
--
-- 'rate', 'savingsPlanRate_rate' - The rate.
--
-- 'serviceCode', 'savingsPlanRate_serviceCode' - The service.
--
-- 'unit', 'savingsPlanRate_unit' - The unit.
--
-- 'properties', 'savingsPlanRate_properties' - The properties.
newSavingsPlanRate ::
  SavingsPlanRate
newSavingsPlanRate :: SavingsPlanRate
newSavingsPlanRate =
  SavingsPlanRate' :: Maybe Text
-> Maybe Text
-> Maybe SavingsPlanProductType
-> Maybe CurrencyCode
-> Maybe Text
-> Maybe SavingsPlanRateServiceCode
-> Maybe SavingsPlanRateUnit
-> Maybe [SavingsPlanRateProperty]
-> SavingsPlanRate
SavingsPlanRate'
    { $sel:operation:SavingsPlanRate' :: Maybe Text
operation = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:usageType:SavingsPlanRate' :: Maybe Text
usageType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:productType:SavingsPlanRate' :: Maybe SavingsPlanProductType
productType = Maybe SavingsPlanProductType
forall a. Maybe a
Prelude.Nothing,
      $sel:currency:SavingsPlanRate' :: Maybe CurrencyCode
currency = Maybe CurrencyCode
forall a. Maybe a
Prelude.Nothing,
      $sel:rate:SavingsPlanRate' :: Maybe Text
rate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceCode:SavingsPlanRate' :: Maybe SavingsPlanRateServiceCode
serviceCode = Maybe SavingsPlanRateServiceCode
forall a. Maybe a
Prelude.Nothing,
      $sel:unit:SavingsPlanRate' :: Maybe SavingsPlanRateUnit
unit = Maybe SavingsPlanRateUnit
forall a. Maybe a
Prelude.Nothing,
      $sel:properties:SavingsPlanRate' :: Maybe [SavingsPlanRateProperty]
properties = Maybe [SavingsPlanRateProperty]
forall a. Maybe a
Prelude.Nothing
    }

-- | The specific AWS operation for the line item in the billing report.
savingsPlanRate_operation :: Lens.Lens' SavingsPlanRate (Prelude.Maybe Prelude.Text)
savingsPlanRate_operation :: (Maybe Text -> f (Maybe Text))
-> SavingsPlanRate -> f SavingsPlanRate
savingsPlanRate_operation = (SavingsPlanRate -> Maybe Text)
-> (SavingsPlanRate -> Maybe Text -> SavingsPlanRate)
-> Lens SavingsPlanRate SavingsPlanRate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlanRate' {Maybe Text
operation :: Maybe Text
$sel:operation:SavingsPlanRate' :: SavingsPlanRate -> Maybe Text
operation} -> Maybe Text
operation) (\s :: SavingsPlanRate
s@SavingsPlanRate' {} Maybe Text
a -> SavingsPlanRate
s {$sel:operation:SavingsPlanRate' :: Maybe Text
operation = Maybe Text
a} :: SavingsPlanRate)

-- | The usage details of the line item in the billing report.
savingsPlanRate_usageType :: Lens.Lens' SavingsPlanRate (Prelude.Maybe Prelude.Text)
savingsPlanRate_usageType :: (Maybe Text -> f (Maybe Text))
-> SavingsPlanRate -> f SavingsPlanRate
savingsPlanRate_usageType = (SavingsPlanRate -> Maybe Text)
-> (SavingsPlanRate -> Maybe Text -> SavingsPlanRate)
-> Lens SavingsPlanRate SavingsPlanRate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlanRate' {Maybe Text
usageType :: Maybe Text
$sel:usageType:SavingsPlanRate' :: SavingsPlanRate -> Maybe Text
usageType} -> Maybe Text
usageType) (\s :: SavingsPlanRate
s@SavingsPlanRate' {} Maybe Text
a -> SavingsPlanRate
s {$sel:usageType:SavingsPlanRate' :: Maybe Text
usageType = Maybe Text
a} :: SavingsPlanRate)

-- | The product type.
savingsPlanRate_productType :: Lens.Lens' SavingsPlanRate (Prelude.Maybe SavingsPlanProductType)
savingsPlanRate_productType :: (Maybe SavingsPlanProductType -> f (Maybe SavingsPlanProductType))
-> SavingsPlanRate -> f SavingsPlanRate
savingsPlanRate_productType = (SavingsPlanRate -> Maybe SavingsPlanProductType)
-> (SavingsPlanRate
    -> Maybe SavingsPlanProductType -> SavingsPlanRate)
-> Lens
     SavingsPlanRate
     SavingsPlanRate
     (Maybe SavingsPlanProductType)
     (Maybe SavingsPlanProductType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlanRate' {Maybe SavingsPlanProductType
productType :: Maybe SavingsPlanProductType
$sel:productType:SavingsPlanRate' :: SavingsPlanRate -> Maybe SavingsPlanProductType
productType} -> Maybe SavingsPlanProductType
productType) (\s :: SavingsPlanRate
s@SavingsPlanRate' {} Maybe SavingsPlanProductType
a -> SavingsPlanRate
s {$sel:productType:SavingsPlanRate' :: Maybe SavingsPlanProductType
productType = Maybe SavingsPlanProductType
a} :: SavingsPlanRate)

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

-- | The rate.
savingsPlanRate_rate :: Lens.Lens' SavingsPlanRate (Prelude.Maybe Prelude.Text)
savingsPlanRate_rate :: (Maybe Text -> f (Maybe Text))
-> SavingsPlanRate -> f SavingsPlanRate
savingsPlanRate_rate = (SavingsPlanRate -> Maybe Text)
-> (SavingsPlanRate -> Maybe Text -> SavingsPlanRate)
-> Lens SavingsPlanRate SavingsPlanRate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlanRate' {Maybe Text
rate :: Maybe Text
$sel:rate:SavingsPlanRate' :: SavingsPlanRate -> Maybe Text
rate} -> Maybe Text
rate) (\s :: SavingsPlanRate
s@SavingsPlanRate' {} Maybe Text
a -> SavingsPlanRate
s {$sel:rate:SavingsPlanRate' :: Maybe Text
rate = Maybe Text
a} :: SavingsPlanRate)

-- | The service.
savingsPlanRate_serviceCode :: Lens.Lens' SavingsPlanRate (Prelude.Maybe SavingsPlanRateServiceCode)
savingsPlanRate_serviceCode :: (Maybe SavingsPlanRateServiceCode
 -> f (Maybe SavingsPlanRateServiceCode))
-> SavingsPlanRate -> f SavingsPlanRate
savingsPlanRate_serviceCode = (SavingsPlanRate -> Maybe SavingsPlanRateServiceCode)
-> (SavingsPlanRate
    -> Maybe SavingsPlanRateServiceCode -> SavingsPlanRate)
-> Lens
     SavingsPlanRate
     SavingsPlanRate
     (Maybe SavingsPlanRateServiceCode)
     (Maybe SavingsPlanRateServiceCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlanRate' {Maybe SavingsPlanRateServiceCode
serviceCode :: Maybe SavingsPlanRateServiceCode
$sel:serviceCode:SavingsPlanRate' :: SavingsPlanRate -> Maybe SavingsPlanRateServiceCode
serviceCode} -> Maybe SavingsPlanRateServiceCode
serviceCode) (\s :: SavingsPlanRate
s@SavingsPlanRate' {} Maybe SavingsPlanRateServiceCode
a -> SavingsPlanRate
s {$sel:serviceCode:SavingsPlanRate' :: Maybe SavingsPlanRateServiceCode
serviceCode = Maybe SavingsPlanRateServiceCode
a} :: SavingsPlanRate)

-- | The unit.
savingsPlanRate_unit :: Lens.Lens' SavingsPlanRate (Prelude.Maybe SavingsPlanRateUnit)
savingsPlanRate_unit :: (Maybe SavingsPlanRateUnit -> f (Maybe SavingsPlanRateUnit))
-> SavingsPlanRate -> f SavingsPlanRate
savingsPlanRate_unit = (SavingsPlanRate -> Maybe SavingsPlanRateUnit)
-> (SavingsPlanRate
    -> Maybe SavingsPlanRateUnit -> SavingsPlanRate)
-> Lens
     SavingsPlanRate
     SavingsPlanRate
     (Maybe SavingsPlanRateUnit)
     (Maybe SavingsPlanRateUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlanRate' {Maybe SavingsPlanRateUnit
unit :: Maybe SavingsPlanRateUnit
$sel:unit:SavingsPlanRate' :: SavingsPlanRate -> Maybe SavingsPlanRateUnit
unit} -> Maybe SavingsPlanRateUnit
unit) (\s :: SavingsPlanRate
s@SavingsPlanRate' {} Maybe SavingsPlanRateUnit
a -> SavingsPlanRate
s {$sel:unit:SavingsPlanRate' :: Maybe SavingsPlanRateUnit
unit = Maybe SavingsPlanRateUnit
a} :: SavingsPlanRate)

-- | The properties.
savingsPlanRate_properties :: Lens.Lens' SavingsPlanRate (Prelude.Maybe [SavingsPlanRateProperty])
savingsPlanRate_properties :: (Maybe [SavingsPlanRateProperty]
 -> f (Maybe [SavingsPlanRateProperty]))
-> SavingsPlanRate -> f SavingsPlanRate
savingsPlanRate_properties = (SavingsPlanRate -> Maybe [SavingsPlanRateProperty])
-> (SavingsPlanRate
    -> Maybe [SavingsPlanRateProperty] -> SavingsPlanRate)
-> Lens
     SavingsPlanRate
     SavingsPlanRate
     (Maybe [SavingsPlanRateProperty])
     (Maybe [SavingsPlanRateProperty])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlanRate' {Maybe [SavingsPlanRateProperty]
properties :: Maybe [SavingsPlanRateProperty]
$sel:properties:SavingsPlanRate' :: SavingsPlanRate -> Maybe [SavingsPlanRateProperty]
properties} -> Maybe [SavingsPlanRateProperty]
properties) (\s :: SavingsPlanRate
s@SavingsPlanRate' {} Maybe [SavingsPlanRateProperty]
a -> SavingsPlanRate
s {$sel:properties:SavingsPlanRate' :: Maybe [SavingsPlanRateProperty]
properties = Maybe [SavingsPlanRateProperty]
a} :: SavingsPlanRate) ((Maybe [SavingsPlanRateProperty]
  -> f (Maybe [SavingsPlanRateProperty]))
 -> SavingsPlanRate -> f SavingsPlanRate)
-> ((Maybe [SavingsPlanRateProperty]
     -> f (Maybe [SavingsPlanRateProperty]))
    -> Maybe [SavingsPlanRateProperty]
    -> f (Maybe [SavingsPlanRateProperty]))
-> (Maybe [SavingsPlanRateProperty]
    -> f (Maybe [SavingsPlanRateProperty]))
-> SavingsPlanRate
-> f SavingsPlanRate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SavingsPlanRateProperty]
  [SavingsPlanRateProperty]
  [SavingsPlanRateProperty]
  [SavingsPlanRateProperty]
-> Iso
     (Maybe [SavingsPlanRateProperty])
     (Maybe [SavingsPlanRateProperty])
     (Maybe [SavingsPlanRateProperty])
     (Maybe [SavingsPlanRateProperty])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [SavingsPlanRateProperty]
  [SavingsPlanRateProperty]
  [SavingsPlanRateProperty]
  [SavingsPlanRateProperty]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON SavingsPlanRate where
  parseJSON :: Value -> Parser SavingsPlanRate
parseJSON =
    String
-> (Object -> Parser SavingsPlanRate)
-> Value
-> Parser SavingsPlanRate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SavingsPlanRate"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe SavingsPlanProductType
-> Maybe CurrencyCode
-> Maybe Text
-> Maybe SavingsPlanRateServiceCode
-> Maybe SavingsPlanRateUnit
-> Maybe [SavingsPlanRateProperty]
-> SavingsPlanRate
SavingsPlanRate'
            (Maybe Text
 -> Maybe Text
 -> Maybe SavingsPlanProductType
 -> Maybe CurrencyCode
 -> Maybe Text
 -> Maybe SavingsPlanRateServiceCode
 -> Maybe SavingsPlanRateUnit
 -> Maybe [SavingsPlanRateProperty]
 -> SavingsPlanRate)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe SavingsPlanProductType
      -> Maybe CurrencyCode
      -> Maybe Text
      -> Maybe SavingsPlanRateServiceCode
      -> Maybe SavingsPlanRateUnit
      -> Maybe [SavingsPlanRateProperty]
      -> SavingsPlanRate)
forall (f :: * -> *) a b. Functor 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
"operation")
            Parser
  (Maybe Text
   -> Maybe SavingsPlanProductType
   -> Maybe CurrencyCode
   -> Maybe Text
   -> Maybe SavingsPlanRateServiceCode
   -> Maybe SavingsPlanRateUnit
   -> Maybe [SavingsPlanRateProperty]
   -> SavingsPlanRate)
-> Parser (Maybe Text)
-> Parser
     (Maybe SavingsPlanProductType
      -> Maybe CurrencyCode
      -> Maybe Text
      -> Maybe SavingsPlanRateServiceCode
      -> Maybe SavingsPlanRateUnit
      -> Maybe [SavingsPlanRateProperty]
      -> SavingsPlanRate)
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
"usageType")
            Parser
  (Maybe SavingsPlanProductType
   -> Maybe CurrencyCode
   -> Maybe Text
   -> Maybe SavingsPlanRateServiceCode
   -> Maybe SavingsPlanRateUnit
   -> Maybe [SavingsPlanRateProperty]
   -> SavingsPlanRate)
-> Parser (Maybe SavingsPlanProductType)
-> Parser
     (Maybe CurrencyCode
      -> Maybe Text
      -> Maybe SavingsPlanRateServiceCode
      -> Maybe SavingsPlanRateUnit
      -> Maybe [SavingsPlanRateProperty]
      -> SavingsPlanRate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SavingsPlanProductType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"productType")
            Parser
  (Maybe CurrencyCode
   -> Maybe Text
   -> Maybe SavingsPlanRateServiceCode
   -> Maybe SavingsPlanRateUnit
   -> Maybe [SavingsPlanRateProperty]
   -> SavingsPlanRate)
-> Parser (Maybe CurrencyCode)
-> Parser
     (Maybe Text
      -> Maybe SavingsPlanRateServiceCode
      -> Maybe SavingsPlanRateUnit
      -> Maybe [SavingsPlanRateProperty]
      -> SavingsPlanRate)
forall (f :: * -> *) a b. Applicative f => 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 Text
   -> Maybe SavingsPlanRateServiceCode
   -> Maybe SavingsPlanRateUnit
   -> Maybe [SavingsPlanRateProperty]
   -> SavingsPlanRate)
-> Parser (Maybe Text)
-> Parser
     (Maybe SavingsPlanRateServiceCode
      -> Maybe SavingsPlanRateUnit
      -> Maybe [SavingsPlanRateProperty]
      -> SavingsPlanRate)
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
"rate")
            Parser
  (Maybe SavingsPlanRateServiceCode
   -> Maybe SavingsPlanRateUnit
   -> Maybe [SavingsPlanRateProperty]
   -> SavingsPlanRate)
-> Parser (Maybe SavingsPlanRateServiceCode)
-> Parser
     (Maybe SavingsPlanRateUnit
      -> Maybe [SavingsPlanRateProperty] -> SavingsPlanRate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SavingsPlanRateServiceCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"serviceCode")
            Parser
  (Maybe SavingsPlanRateUnit
   -> Maybe [SavingsPlanRateProperty] -> SavingsPlanRate)
-> Parser (Maybe SavingsPlanRateUnit)
-> Parser (Maybe [SavingsPlanRateProperty] -> SavingsPlanRate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SavingsPlanRateUnit)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"unit")
            Parser (Maybe [SavingsPlanRateProperty] -> SavingsPlanRate)
-> Parser (Maybe [SavingsPlanRateProperty])
-> Parser SavingsPlanRate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [SavingsPlanRateProperty]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"properties" Parser (Maybe (Maybe [SavingsPlanRateProperty]))
-> Maybe [SavingsPlanRateProperty]
-> Parser (Maybe [SavingsPlanRateProperty])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [SavingsPlanRateProperty]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable SavingsPlanRate

instance Prelude.NFData SavingsPlanRate