{-# 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.MarketplaceEntitlement.Types.EntitlementValue
-- 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.MarketplaceEntitlement.Types.EntitlementValue 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

-- | The EntitlementValue represents the amount of capacity that the customer
-- is entitled to for the product.
--
-- /See:/ 'newEntitlementValue' smart constructor.
data EntitlementValue = EntitlementValue'
  { -- | The BooleanValue field will be populated with a boolean value when the
    -- entitlement is a boolean type. Otherwise, the field will not be set.
    EntitlementValue -> Maybe Bool
booleanValue :: Prelude.Maybe Prelude.Bool,
    -- | The DoubleValue field will be populated with a double value when the
    -- entitlement is a double type. Otherwise, the field will not be set.
    EntitlementValue -> Maybe Double
doubleValue :: Prelude.Maybe Prelude.Double,
    -- | The IntegerValue field will be populated with an integer value when the
    -- entitlement is an integer type. Otherwise, the field will not be set.
    EntitlementValue -> Maybe Int
integerValue :: Prelude.Maybe Prelude.Int,
    -- | The StringValue field will be populated with a string value when the
    -- entitlement is a string type. Otherwise, the field will not be set.
    EntitlementValue -> Maybe Text
stringValue :: Prelude.Maybe Prelude.Text
  }
  deriving (EntitlementValue -> EntitlementValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EntitlementValue -> EntitlementValue -> Bool
$c/= :: EntitlementValue -> EntitlementValue -> Bool
== :: EntitlementValue -> EntitlementValue -> Bool
$c== :: EntitlementValue -> EntitlementValue -> Bool
Prelude.Eq, ReadPrec [EntitlementValue]
ReadPrec EntitlementValue
Int -> ReadS EntitlementValue
ReadS [EntitlementValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EntitlementValue]
$creadListPrec :: ReadPrec [EntitlementValue]
readPrec :: ReadPrec EntitlementValue
$creadPrec :: ReadPrec EntitlementValue
readList :: ReadS [EntitlementValue]
$creadList :: ReadS [EntitlementValue]
readsPrec :: Int -> ReadS EntitlementValue
$creadsPrec :: Int -> ReadS EntitlementValue
Prelude.Read, Int -> EntitlementValue -> ShowS
[EntitlementValue] -> ShowS
EntitlementValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EntitlementValue] -> ShowS
$cshowList :: [EntitlementValue] -> ShowS
show :: EntitlementValue -> String
$cshow :: EntitlementValue -> String
showsPrec :: Int -> EntitlementValue -> ShowS
$cshowsPrec :: Int -> EntitlementValue -> ShowS
Prelude.Show, forall x. Rep EntitlementValue x -> EntitlementValue
forall x. EntitlementValue -> Rep EntitlementValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EntitlementValue x -> EntitlementValue
$cfrom :: forall x. EntitlementValue -> Rep EntitlementValue x
Prelude.Generic)

-- |
-- Create a value of 'EntitlementValue' 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:
--
-- 'booleanValue', 'entitlementValue_booleanValue' - The BooleanValue field will be populated with a boolean value when the
-- entitlement is a boolean type. Otherwise, the field will not be set.
--
-- 'doubleValue', 'entitlementValue_doubleValue' - The DoubleValue field will be populated with a double value when the
-- entitlement is a double type. Otherwise, the field will not be set.
--
-- 'integerValue', 'entitlementValue_integerValue' - The IntegerValue field will be populated with an integer value when the
-- entitlement is an integer type. Otherwise, the field will not be set.
--
-- 'stringValue', 'entitlementValue_stringValue' - The StringValue field will be populated with a string value when the
-- entitlement is a string type. Otherwise, the field will not be set.
newEntitlementValue ::
  EntitlementValue
newEntitlementValue :: EntitlementValue
newEntitlementValue =
  EntitlementValue'
    { $sel:booleanValue:EntitlementValue' :: Maybe Bool
booleanValue = forall a. Maybe a
Prelude.Nothing,
      $sel:doubleValue:EntitlementValue' :: Maybe Double
doubleValue = forall a. Maybe a
Prelude.Nothing,
      $sel:integerValue:EntitlementValue' :: Maybe Int
integerValue = forall a. Maybe a
Prelude.Nothing,
      $sel:stringValue:EntitlementValue' :: Maybe Text
stringValue = forall a. Maybe a
Prelude.Nothing
    }

-- | The BooleanValue field will be populated with a boolean value when the
-- entitlement is a boolean type. Otherwise, the field will not be set.
entitlementValue_booleanValue :: Lens.Lens' EntitlementValue (Prelude.Maybe Prelude.Bool)
entitlementValue_booleanValue :: Lens' EntitlementValue (Maybe Bool)
entitlementValue_booleanValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitlementValue' {Maybe Bool
booleanValue :: Maybe Bool
$sel:booleanValue:EntitlementValue' :: EntitlementValue -> Maybe Bool
booleanValue} -> Maybe Bool
booleanValue) (\s :: EntitlementValue
s@EntitlementValue' {} Maybe Bool
a -> EntitlementValue
s {$sel:booleanValue:EntitlementValue' :: Maybe Bool
booleanValue = Maybe Bool
a} :: EntitlementValue)

-- | The DoubleValue field will be populated with a double value when the
-- entitlement is a double type. Otherwise, the field will not be set.
entitlementValue_doubleValue :: Lens.Lens' EntitlementValue (Prelude.Maybe Prelude.Double)
entitlementValue_doubleValue :: Lens' EntitlementValue (Maybe Double)
entitlementValue_doubleValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitlementValue' {Maybe Double
doubleValue :: Maybe Double
$sel:doubleValue:EntitlementValue' :: EntitlementValue -> Maybe Double
doubleValue} -> Maybe Double
doubleValue) (\s :: EntitlementValue
s@EntitlementValue' {} Maybe Double
a -> EntitlementValue
s {$sel:doubleValue:EntitlementValue' :: Maybe Double
doubleValue = Maybe Double
a} :: EntitlementValue)

-- | The IntegerValue field will be populated with an integer value when the
-- entitlement is an integer type. Otherwise, the field will not be set.
entitlementValue_integerValue :: Lens.Lens' EntitlementValue (Prelude.Maybe Prelude.Int)
entitlementValue_integerValue :: Lens' EntitlementValue (Maybe Int)
entitlementValue_integerValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitlementValue' {Maybe Int
integerValue :: Maybe Int
$sel:integerValue:EntitlementValue' :: EntitlementValue -> Maybe Int
integerValue} -> Maybe Int
integerValue) (\s :: EntitlementValue
s@EntitlementValue' {} Maybe Int
a -> EntitlementValue
s {$sel:integerValue:EntitlementValue' :: Maybe Int
integerValue = Maybe Int
a} :: EntitlementValue)

-- | The StringValue field will be populated with a string value when the
-- entitlement is a string type. Otherwise, the field will not be set.
entitlementValue_stringValue :: Lens.Lens' EntitlementValue (Prelude.Maybe Prelude.Text)
entitlementValue_stringValue :: Lens' EntitlementValue (Maybe Text)
entitlementValue_stringValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntitlementValue' {Maybe Text
stringValue :: Maybe Text
$sel:stringValue:EntitlementValue' :: EntitlementValue -> Maybe Text
stringValue} -> Maybe Text
stringValue) (\s :: EntitlementValue
s@EntitlementValue' {} Maybe Text
a -> EntitlementValue
s {$sel:stringValue:EntitlementValue' :: Maybe Text
stringValue = Maybe Text
a} :: EntitlementValue)

instance Data.FromJSON EntitlementValue where
  parseJSON :: Value -> Parser EntitlementValue
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EntitlementValue"
      ( \Object
x ->
          Maybe Bool
-> Maybe Double -> Maybe Int -> Maybe Text -> EntitlementValue
EntitlementValue'
            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
"BooleanValue")
            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
"DoubleValue")
            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
"IntegerValue")
            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
"StringValue")
      )

instance Prelude.Hashable EntitlementValue where
  hashWithSalt :: Int -> EntitlementValue -> Int
hashWithSalt Int
_salt EntitlementValue' {Maybe Bool
Maybe Double
Maybe Int
Maybe Text
stringValue :: Maybe Text
integerValue :: Maybe Int
doubleValue :: Maybe Double
booleanValue :: Maybe Bool
$sel:stringValue:EntitlementValue' :: EntitlementValue -> Maybe Text
$sel:integerValue:EntitlementValue' :: EntitlementValue -> Maybe Int
$sel:doubleValue:EntitlementValue' :: EntitlementValue -> Maybe Double
$sel:booleanValue:EntitlementValue' :: EntitlementValue -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
booleanValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
doubleValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
integerValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stringValue

instance Prelude.NFData EntitlementValue where
  rnf :: EntitlementValue -> ()
rnf EntitlementValue' {Maybe Bool
Maybe Double
Maybe Int
Maybe Text
stringValue :: Maybe Text
integerValue :: Maybe Int
doubleValue :: Maybe Double
booleanValue :: Maybe Bool
$sel:stringValue:EntitlementValue' :: EntitlementValue -> Maybe Text
$sel:integerValue:EntitlementValue' :: EntitlementValue -> Maybe Int
$sel:doubleValue:EntitlementValue' :: EntitlementValue -> Maybe Double
$sel:booleanValue:EntitlementValue' :: EntitlementValue -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
booleanValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
doubleValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
integerValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stringValue