{-# 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.PricingPlan
-- 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.PricingPlan 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.BundleInformation
import Amazonka.IotTwinMaker.Types.PricingMode
import Amazonka.IotTwinMaker.Types.UpdateReason
import qualified Amazonka.Prelude as Prelude

-- | The pricing plan.
--
-- /See:/ 'newPricingPlan' smart constructor.
data PricingPlan = PricingPlan'
  { -- | The billable entity count.
    PricingPlan -> Maybe Integer
billableEntityCount :: Prelude.Maybe Prelude.Integer,
    -- | The pricing plan\'s bundle information.
    PricingPlan -> Maybe BundleInformation
bundleInformation :: Prelude.Maybe BundleInformation,
    -- | The effective date and time of the pricing plan.
    PricingPlan -> POSIX
effectiveDateTime :: Data.POSIX,
    -- | The pricing mode.
    PricingPlan -> PricingMode
pricingMode :: PricingMode,
    -- | The set date and time for updating a pricing plan.
    PricingPlan -> POSIX
updateDateTime :: Data.POSIX,
    -- | The update reason, for changing a pricing plan.
    PricingPlan -> UpdateReason
updateReason :: UpdateReason
  }
  deriving (PricingPlan -> PricingPlan -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PricingPlan -> PricingPlan -> Bool
$c/= :: PricingPlan -> PricingPlan -> Bool
== :: PricingPlan -> PricingPlan -> Bool
$c== :: PricingPlan -> PricingPlan -> Bool
Prelude.Eq, ReadPrec [PricingPlan]
ReadPrec PricingPlan
Int -> ReadS PricingPlan
ReadS [PricingPlan]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PricingPlan]
$creadListPrec :: ReadPrec [PricingPlan]
readPrec :: ReadPrec PricingPlan
$creadPrec :: ReadPrec PricingPlan
readList :: ReadS [PricingPlan]
$creadList :: ReadS [PricingPlan]
readsPrec :: Int -> ReadS PricingPlan
$creadsPrec :: Int -> ReadS PricingPlan
Prelude.Read, Int -> PricingPlan -> ShowS
[PricingPlan] -> ShowS
PricingPlan -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PricingPlan] -> ShowS
$cshowList :: [PricingPlan] -> ShowS
show :: PricingPlan -> String
$cshow :: PricingPlan -> String
showsPrec :: Int -> PricingPlan -> ShowS
$cshowsPrec :: Int -> PricingPlan -> ShowS
Prelude.Show, forall x. Rep PricingPlan x -> PricingPlan
forall x. PricingPlan -> Rep PricingPlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PricingPlan x -> PricingPlan
$cfrom :: forall x. PricingPlan -> Rep PricingPlan x
Prelude.Generic)

-- |
-- Create a value of 'PricingPlan' 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:
--
-- 'billableEntityCount', 'pricingPlan_billableEntityCount' - The billable entity count.
--
-- 'bundleInformation', 'pricingPlan_bundleInformation' - The pricing plan\'s bundle information.
--
-- 'effectiveDateTime', 'pricingPlan_effectiveDateTime' - The effective date and time of the pricing plan.
--
-- 'pricingMode', 'pricingPlan_pricingMode' - The pricing mode.
--
-- 'updateDateTime', 'pricingPlan_updateDateTime' - The set date and time for updating a pricing plan.
--
-- 'updateReason', 'pricingPlan_updateReason' - The update reason, for changing a pricing plan.
newPricingPlan ::
  -- | 'effectiveDateTime'
  Prelude.UTCTime ->
  -- | 'pricingMode'
  PricingMode ->
  -- | 'updateDateTime'
  Prelude.UTCTime ->
  -- | 'updateReason'
  UpdateReason ->
  PricingPlan
newPricingPlan :: UTCTime -> PricingMode -> UTCTime -> UpdateReason -> PricingPlan
newPricingPlan
  UTCTime
pEffectiveDateTime_
  PricingMode
pPricingMode_
  UTCTime
pUpdateDateTime_
  UpdateReason
pUpdateReason_ =
    PricingPlan'
      { $sel:billableEntityCount:PricingPlan' :: Maybe Integer
billableEntityCount = forall a. Maybe a
Prelude.Nothing,
        $sel:bundleInformation:PricingPlan' :: Maybe BundleInformation
bundleInformation = forall a. Maybe a
Prelude.Nothing,
        $sel:effectiveDateTime:PricingPlan' :: POSIX
effectiveDateTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEffectiveDateTime_,
        $sel:pricingMode:PricingPlan' :: PricingMode
pricingMode = PricingMode
pPricingMode_,
        $sel:updateDateTime:PricingPlan' :: POSIX
updateDateTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdateDateTime_,
        $sel:updateReason:PricingPlan' :: UpdateReason
updateReason = UpdateReason
pUpdateReason_
      }

-- | The billable entity count.
pricingPlan_billableEntityCount :: Lens.Lens' PricingPlan (Prelude.Maybe Prelude.Integer)
pricingPlan_billableEntityCount :: Lens' PricingPlan (Maybe Integer)
pricingPlan_billableEntityCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PricingPlan' {Maybe Integer
billableEntityCount :: Maybe Integer
$sel:billableEntityCount:PricingPlan' :: PricingPlan -> Maybe Integer
billableEntityCount} -> Maybe Integer
billableEntityCount) (\s :: PricingPlan
s@PricingPlan' {} Maybe Integer
a -> PricingPlan
s {$sel:billableEntityCount:PricingPlan' :: Maybe Integer
billableEntityCount = Maybe Integer
a} :: PricingPlan)

-- | The pricing plan\'s bundle information.
pricingPlan_bundleInformation :: Lens.Lens' PricingPlan (Prelude.Maybe BundleInformation)
pricingPlan_bundleInformation :: Lens' PricingPlan (Maybe BundleInformation)
pricingPlan_bundleInformation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PricingPlan' {Maybe BundleInformation
bundleInformation :: Maybe BundleInformation
$sel:bundleInformation:PricingPlan' :: PricingPlan -> Maybe BundleInformation
bundleInformation} -> Maybe BundleInformation
bundleInformation) (\s :: PricingPlan
s@PricingPlan' {} Maybe BundleInformation
a -> PricingPlan
s {$sel:bundleInformation:PricingPlan' :: Maybe BundleInformation
bundleInformation = Maybe BundleInformation
a} :: PricingPlan)

-- | The effective date and time of the pricing plan.
pricingPlan_effectiveDateTime :: Lens.Lens' PricingPlan Prelude.UTCTime
pricingPlan_effectiveDateTime :: Lens' PricingPlan UTCTime
pricingPlan_effectiveDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PricingPlan' {POSIX
effectiveDateTime :: POSIX
$sel:effectiveDateTime:PricingPlan' :: PricingPlan -> POSIX
effectiveDateTime} -> POSIX
effectiveDateTime) (\s :: PricingPlan
s@PricingPlan' {} POSIX
a -> PricingPlan
s {$sel:effectiveDateTime:PricingPlan' :: POSIX
effectiveDateTime = POSIX
a} :: PricingPlan) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The pricing mode.
pricingPlan_pricingMode :: Lens.Lens' PricingPlan PricingMode
pricingPlan_pricingMode :: Lens' PricingPlan PricingMode
pricingPlan_pricingMode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PricingPlan' {PricingMode
pricingMode :: PricingMode
$sel:pricingMode:PricingPlan' :: PricingPlan -> PricingMode
pricingMode} -> PricingMode
pricingMode) (\s :: PricingPlan
s@PricingPlan' {} PricingMode
a -> PricingPlan
s {$sel:pricingMode:PricingPlan' :: PricingMode
pricingMode = PricingMode
a} :: PricingPlan)

-- | The set date and time for updating a pricing plan.
pricingPlan_updateDateTime :: Lens.Lens' PricingPlan Prelude.UTCTime
pricingPlan_updateDateTime :: Lens' PricingPlan UTCTime
pricingPlan_updateDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PricingPlan' {POSIX
updateDateTime :: POSIX
$sel:updateDateTime:PricingPlan' :: PricingPlan -> POSIX
updateDateTime} -> POSIX
updateDateTime) (\s :: PricingPlan
s@PricingPlan' {} POSIX
a -> PricingPlan
s {$sel:updateDateTime:PricingPlan' :: POSIX
updateDateTime = POSIX
a} :: PricingPlan) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The update reason, for changing a pricing plan.
pricingPlan_updateReason :: Lens.Lens' PricingPlan UpdateReason
pricingPlan_updateReason :: Lens' PricingPlan UpdateReason
pricingPlan_updateReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PricingPlan' {UpdateReason
updateReason :: UpdateReason
$sel:updateReason:PricingPlan' :: PricingPlan -> UpdateReason
updateReason} -> UpdateReason
updateReason) (\s :: PricingPlan
s@PricingPlan' {} UpdateReason
a -> PricingPlan
s {$sel:updateReason:PricingPlan' :: UpdateReason
updateReason = UpdateReason
a} :: PricingPlan)

instance Data.FromJSON PricingPlan where
  parseJSON :: Value -> Parser PricingPlan
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PricingPlan"
      ( \Object
x ->
          Maybe Integer
-> Maybe BundleInformation
-> POSIX
-> PricingMode
-> POSIX
-> UpdateReason
-> PricingPlan
PricingPlan'
            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
"billableEntityCount")
            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
"bundleInformation")
            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
"effectiveDateTime")
            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
"pricingMode")
            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
"updateDateTime")
            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
"updateReason")
      )

instance Prelude.Hashable PricingPlan where
  hashWithSalt :: Int -> PricingPlan -> Int
hashWithSalt Int
_salt PricingPlan' {Maybe Integer
Maybe BundleInformation
POSIX
PricingMode
UpdateReason
updateReason :: UpdateReason
updateDateTime :: POSIX
pricingMode :: PricingMode
effectiveDateTime :: POSIX
bundleInformation :: Maybe BundleInformation
billableEntityCount :: Maybe Integer
$sel:updateReason:PricingPlan' :: PricingPlan -> UpdateReason
$sel:updateDateTime:PricingPlan' :: PricingPlan -> POSIX
$sel:pricingMode:PricingPlan' :: PricingPlan -> PricingMode
$sel:effectiveDateTime:PricingPlan' :: PricingPlan -> POSIX
$sel:bundleInformation:PricingPlan' :: PricingPlan -> Maybe BundleInformation
$sel:billableEntityCount:PricingPlan' :: PricingPlan -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
billableEntityCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BundleInformation
bundleInformation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
effectiveDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PricingMode
pricingMode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
updateDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` UpdateReason
updateReason

instance Prelude.NFData PricingPlan where
  rnf :: PricingPlan -> ()
rnf PricingPlan' {Maybe Integer
Maybe BundleInformation
POSIX
PricingMode
UpdateReason
updateReason :: UpdateReason
updateDateTime :: POSIX
pricingMode :: PricingMode
effectiveDateTime :: POSIX
bundleInformation :: Maybe BundleInformation
billableEntityCount :: Maybe Integer
$sel:updateReason:PricingPlan' :: PricingPlan -> UpdateReason
$sel:updateDateTime:PricingPlan' :: PricingPlan -> POSIX
$sel:pricingMode:PricingPlan' :: PricingPlan -> PricingMode
$sel:effectiveDateTime:PricingPlan' :: PricingPlan -> POSIX
$sel:bundleInformation:PricingPlan' :: PricingPlan -> Maybe BundleInformation
$sel:billableEntityCount:PricingPlan' :: PricingPlan -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
billableEntityCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BundleInformation
bundleInformation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
effectiveDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PricingMode
pricingMode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
updateDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf UpdateReason
updateReason