{-# 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.IotTwinMaker.Types.BundleInformation
-- 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.IotTwinMaker.Types.BundleInformation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IotTwinMaker.Types.PricingTier
import qualified Amazonka.Prelude as Prelude

-- | Information about pricing bundle.
--
-- /See:/ 'newBundleInformation' smart constructor.
data BundleInformation = BundleInformation'
  { -- | The pricing tier.
    BundleInformation -> Maybe PricingTier
pricingTier :: Prelude.Maybe PricingTier,
    -- | The bundle names.
    BundleInformation -> NonEmpty Text
bundleNames :: Prelude.NonEmpty Prelude.Text
  }
  deriving (BundleInformation -> BundleInformation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BundleInformation -> BundleInformation -> Bool
$c/= :: BundleInformation -> BundleInformation -> Bool
== :: BundleInformation -> BundleInformation -> Bool
$c== :: BundleInformation -> BundleInformation -> Bool
Prelude.Eq, ReadPrec [BundleInformation]
ReadPrec BundleInformation
Int -> ReadS BundleInformation
ReadS [BundleInformation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BundleInformation]
$creadListPrec :: ReadPrec [BundleInformation]
readPrec :: ReadPrec BundleInformation
$creadPrec :: ReadPrec BundleInformation
readList :: ReadS [BundleInformation]
$creadList :: ReadS [BundleInformation]
readsPrec :: Int -> ReadS BundleInformation
$creadsPrec :: Int -> ReadS BundleInformation
Prelude.Read, Int -> BundleInformation -> ShowS
[BundleInformation] -> ShowS
BundleInformation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BundleInformation] -> ShowS
$cshowList :: [BundleInformation] -> ShowS
show :: BundleInformation -> String
$cshow :: BundleInformation -> String
showsPrec :: Int -> BundleInformation -> ShowS
$cshowsPrec :: Int -> BundleInformation -> ShowS
Prelude.Show, forall x. Rep BundleInformation x -> BundleInformation
forall x. BundleInformation -> Rep BundleInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BundleInformation x -> BundleInformation
$cfrom :: forall x. BundleInformation -> Rep BundleInformation x
Prelude.Generic)

-- |
-- Create a value of 'BundleInformation' 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:
--
-- 'pricingTier', 'bundleInformation_pricingTier' - The pricing tier.
--
-- 'bundleNames', 'bundleInformation_bundleNames' - The bundle names.
newBundleInformation ::
  -- | 'bundleNames'
  Prelude.NonEmpty Prelude.Text ->
  BundleInformation
newBundleInformation :: NonEmpty Text -> BundleInformation
newBundleInformation NonEmpty Text
pBundleNames_ =
  BundleInformation'
    { $sel:pricingTier:BundleInformation' :: Maybe PricingTier
pricingTier = forall a. Maybe a
Prelude.Nothing,
      $sel:bundleNames:BundleInformation' :: NonEmpty Text
bundleNames = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pBundleNames_
    }

-- | The pricing tier.
bundleInformation_pricingTier :: Lens.Lens' BundleInformation (Prelude.Maybe PricingTier)
bundleInformation_pricingTier :: Lens' BundleInformation (Maybe PricingTier)
bundleInformation_pricingTier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BundleInformation' {Maybe PricingTier
pricingTier :: Maybe PricingTier
$sel:pricingTier:BundleInformation' :: BundleInformation -> Maybe PricingTier
pricingTier} -> Maybe PricingTier
pricingTier) (\s :: BundleInformation
s@BundleInformation' {} Maybe PricingTier
a -> BundleInformation
s {$sel:pricingTier:BundleInformation' :: Maybe PricingTier
pricingTier = Maybe PricingTier
a} :: BundleInformation)

-- | The bundle names.
bundleInformation_bundleNames :: Lens.Lens' BundleInformation (Prelude.NonEmpty Prelude.Text)
bundleInformation_bundleNames :: Lens' BundleInformation (NonEmpty Text)
bundleInformation_bundleNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BundleInformation' {NonEmpty Text
bundleNames :: NonEmpty Text
$sel:bundleNames:BundleInformation' :: BundleInformation -> NonEmpty Text
bundleNames} -> NonEmpty Text
bundleNames) (\s :: BundleInformation
s@BundleInformation' {} NonEmpty Text
a -> BundleInformation
s {$sel:bundleNames:BundleInformation' :: NonEmpty Text
bundleNames = NonEmpty Text
a} :: BundleInformation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON BundleInformation where
  parseJSON :: Value -> Parser BundleInformation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BundleInformation"
      ( \Object
x ->
          Maybe PricingTier -> NonEmpty Text -> BundleInformation
BundleInformation'
            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
"pricingTier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"bundleNames")
      )

instance Prelude.Hashable BundleInformation where
  hashWithSalt :: Int -> BundleInformation -> Int
hashWithSalt Int
_salt BundleInformation' {Maybe PricingTier
NonEmpty Text
bundleNames :: NonEmpty Text
pricingTier :: Maybe PricingTier
$sel:bundleNames:BundleInformation' :: BundleInformation -> NonEmpty Text
$sel:pricingTier:BundleInformation' :: BundleInformation -> Maybe PricingTier
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PricingTier
pricingTier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
bundleNames

instance Prelude.NFData BundleInformation where
  rnf :: BundleInformation -> ()
rnf BundleInformation' {Maybe PricingTier
NonEmpty Text
bundleNames :: NonEmpty Text
pricingTier :: Maybe PricingTier
$sel:bundleNames:BundleInformation' :: BundleInformation -> NonEmpty Text
$sel:pricingTier:BundleInformation' :: BundleInformation -> Maybe PricingTier
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PricingTier
pricingTier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
bundleNames