{-# 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.SavingsPlanOfferingProperty
-- 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.SavingsPlanOfferingProperty where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SavingsPlans.Types.SavingsPlanOfferingPropertyKey

-- | Information about a property.
--
-- /See:/ 'newSavingsPlanOfferingProperty' smart constructor.
data SavingsPlanOfferingProperty = SavingsPlanOfferingProperty'
  { -- | The property value.
    SavingsPlanOfferingProperty -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The property name.
    SavingsPlanOfferingProperty -> Maybe SavingsPlanOfferingPropertyKey
name :: Prelude.Maybe SavingsPlanOfferingPropertyKey
  }
  deriving (SavingsPlanOfferingProperty -> SavingsPlanOfferingProperty -> Bool
(SavingsPlanOfferingProperty
 -> SavingsPlanOfferingProperty -> Bool)
-> (SavingsPlanOfferingProperty
    -> SavingsPlanOfferingProperty -> Bool)
-> Eq SavingsPlanOfferingProperty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SavingsPlanOfferingProperty -> SavingsPlanOfferingProperty -> Bool
$c/= :: SavingsPlanOfferingProperty -> SavingsPlanOfferingProperty -> Bool
== :: SavingsPlanOfferingProperty -> SavingsPlanOfferingProperty -> Bool
$c== :: SavingsPlanOfferingProperty -> SavingsPlanOfferingProperty -> Bool
Prelude.Eq, ReadPrec [SavingsPlanOfferingProperty]
ReadPrec SavingsPlanOfferingProperty
Int -> ReadS SavingsPlanOfferingProperty
ReadS [SavingsPlanOfferingProperty]
(Int -> ReadS SavingsPlanOfferingProperty)
-> ReadS [SavingsPlanOfferingProperty]
-> ReadPrec SavingsPlanOfferingProperty
-> ReadPrec [SavingsPlanOfferingProperty]
-> Read SavingsPlanOfferingProperty
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SavingsPlanOfferingProperty]
$creadListPrec :: ReadPrec [SavingsPlanOfferingProperty]
readPrec :: ReadPrec SavingsPlanOfferingProperty
$creadPrec :: ReadPrec SavingsPlanOfferingProperty
readList :: ReadS [SavingsPlanOfferingProperty]
$creadList :: ReadS [SavingsPlanOfferingProperty]
readsPrec :: Int -> ReadS SavingsPlanOfferingProperty
$creadsPrec :: Int -> ReadS SavingsPlanOfferingProperty
Prelude.Read, Int -> SavingsPlanOfferingProperty -> ShowS
[SavingsPlanOfferingProperty] -> ShowS
SavingsPlanOfferingProperty -> String
(Int -> SavingsPlanOfferingProperty -> ShowS)
-> (SavingsPlanOfferingProperty -> String)
-> ([SavingsPlanOfferingProperty] -> ShowS)
-> Show SavingsPlanOfferingProperty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SavingsPlanOfferingProperty] -> ShowS
$cshowList :: [SavingsPlanOfferingProperty] -> ShowS
show :: SavingsPlanOfferingProperty -> String
$cshow :: SavingsPlanOfferingProperty -> String
showsPrec :: Int -> SavingsPlanOfferingProperty -> ShowS
$cshowsPrec :: Int -> SavingsPlanOfferingProperty -> ShowS
Prelude.Show, (forall x.
 SavingsPlanOfferingProperty -> Rep SavingsPlanOfferingProperty x)
-> (forall x.
    Rep SavingsPlanOfferingProperty x -> SavingsPlanOfferingProperty)
-> Generic SavingsPlanOfferingProperty
forall x.
Rep SavingsPlanOfferingProperty x -> SavingsPlanOfferingProperty
forall x.
SavingsPlanOfferingProperty -> Rep SavingsPlanOfferingProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SavingsPlanOfferingProperty x -> SavingsPlanOfferingProperty
$cfrom :: forall x.
SavingsPlanOfferingProperty -> Rep SavingsPlanOfferingProperty x
Prelude.Generic)

-- |
-- Create a value of 'SavingsPlanOfferingProperty' 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:
--
-- 'value', 'savingsPlanOfferingProperty_value' - The property value.
--
-- 'name', 'savingsPlanOfferingProperty_name' - The property name.
newSavingsPlanOfferingProperty ::
  SavingsPlanOfferingProperty
newSavingsPlanOfferingProperty :: SavingsPlanOfferingProperty
newSavingsPlanOfferingProperty =
  SavingsPlanOfferingProperty' :: Maybe Text
-> Maybe SavingsPlanOfferingPropertyKey
-> SavingsPlanOfferingProperty
SavingsPlanOfferingProperty'
    { $sel:value:SavingsPlanOfferingProperty' :: Maybe Text
value =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:SavingsPlanOfferingProperty' :: Maybe SavingsPlanOfferingPropertyKey
name = Maybe SavingsPlanOfferingPropertyKey
forall a. Maybe a
Prelude.Nothing
    }

-- | The property value.
savingsPlanOfferingProperty_value :: Lens.Lens' SavingsPlanOfferingProperty (Prelude.Maybe Prelude.Text)
savingsPlanOfferingProperty_value :: (Maybe Text -> f (Maybe Text))
-> SavingsPlanOfferingProperty -> f SavingsPlanOfferingProperty
savingsPlanOfferingProperty_value = (SavingsPlanOfferingProperty -> Maybe Text)
-> (SavingsPlanOfferingProperty
    -> Maybe Text -> SavingsPlanOfferingProperty)
-> Lens
     SavingsPlanOfferingProperty
     SavingsPlanOfferingProperty
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlanOfferingProperty' {Maybe Text
value :: Maybe Text
$sel:value:SavingsPlanOfferingProperty' :: SavingsPlanOfferingProperty -> Maybe Text
value} -> Maybe Text
value) (\s :: SavingsPlanOfferingProperty
s@SavingsPlanOfferingProperty' {} Maybe Text
a -> SavingsPlanOfferingProperty
s {$sel:value:SavingsPlanOfferingProperty' :: Maybe Text
value = Maybe Text
a} :: SavingsPlanOfferingProperty)

-- | The property name.
savingsPlanOfferingProperty_name :: Lens.Lens' SavingsPlanOfferingProperty (Prelude.Maybe SavingsPlanOfferingPropertyKey)
savingsPlanOfferingProperty_name :: (Maybe SavingsPlanOfferingPropertyKey
 -> f (Maybe SavingsPlanOfferingPropertyKey))
-> SavingsPlanOfferingProperty -> f SavingsPlanOfferingProperty
savingsPlanOfferingProperty_name = (SavingsPlanOfferingProperty
 -> Maybe SavingsPlanOfferingPropertyKey)
-> (SavingsPlanOfferingProperty
    -> Maybe SavingsPlanOfferingPropertyKey
    -> SavingsPlanOfferingProperty)
-> Lens
     SavingsPlanOfferingProperty
     SavingsPlanOfferingProperty
     (Maybe SavingsPlanOfferingPropertyKey)
     (Maybe SavingsPlanOfferingPropertyKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlanOfferingProperty' {Maybe SavingsPlanOfferingPropertyKey
name :: Maybe SavingsPlanOfferingPropertyKey
$sel:name:SavingsPlanOfferingProperty' :: SavingsPlanOfferingProperty -> Maybe SavingsPlanOfferingPropertyKey
name} -> Maybe SavingsPlanOfferingPropertyKey
name) (\s :: SavingsPlanOfferingProperty
s@SavingsPlanOfferingProperty' {} Maybe SavingsPlanOfferingPropertyKey
a -> SavingsPlanOfferingProperty
s {$sel:name:SavingsPlanOfferingProperty' :: Maybe SavingsPlanOfferingPropertyKey
name = Maybe SavingsPlanOfferingPropertyKey
a} :: SavingsPlanOfferingProperty)

instance Core.FromJSON SavingsPlanOfferingProperty where
  parseJSON :: Value -> Parser SavingsPlanOfferingProperty
parseJSON =
    String
-> (Object -> Parser SavingsPlanOfferingProperty)
-> Value
-> Parser SavingsPlanOfferingProperty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SavingsPlanOfferingProperty"
      ( \Object
x ->
          Maybe Text
-> Maybe SavingsPlanOfferingPropertyKey
-> SavingsPlanOfferingProperty
SavingsPlanOfferingProperty'
            (Maybe Text
 -> Maybe SavingsPlanOfferingPropertyKey
 -> SavingsPlanOfferingProperty)
-> Parser (Maybe Text)
-> Parser
     (Maybe SavingsPlanOfferingPropertyKey
      -> SavingsPlanOfferingProperty)
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
"value") Parser
  (Maybe SavingsPlanOfferingPropertyKey
   -> SavingsPlanOfferingProperty)
-> Parser (Maybe SavingsPlanOfferingPropertyKey)
-> Parser SavingsPlanOfferingProperty
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SavingsPlanOfferingPropertyKey)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
      )

instance Prelude.Hashable SavingsPlanOfferingProperty

instance Prelude.NFData SavingsPlanOfferingProperty