{-# 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.IoTAnalytics.Types.EstimatedResourceSize
-- 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.IoTAnalytics.Types.EstimatedResourceSize 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 estimated size of the resource.
--
-- /See:/ 'newEstimatedResourceSize' smart constructor.
data EstimatedResourceSize = EstimatedResourceSize'
  { -- | The time when the estimate of the size of the resource was made.
    EstimatedResourceSize -> Maybe POSIX
estimatedOn :: Prelude.Maybe Data.POSIX,
    -- | The estimated size of the resource, in bytes.
    EstimatedResourceSize -> Maybe Double
estimatedSizeInBytes :: Prelude.Maybe Prelude.Double
  }
  deriving (EstimatedResourceSize -> EstimatedResourceSize -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EstimatedResourceSize -> EstimatedResourceSize -> Bool
$c/= :: EstimatedResourceSize -> EstimatedResourceSize -> Bool
== :: EstimatedResourceSize -> EstimatedResourceSize -> Bool
$c== :: EstimatedResourceSize -> EstimatedResourceSize -> Bool
Prelude.Eq, ReadPrec [EstimatedResourceSize]
ReadPrec EstimatedResourceSize
Int -> ReadS EstimatedResourceSize
ReadS [EstimatedResourceSize]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EstimatedResourceSize]
$creadListPrec :: ReadPrec [EstimatedResourceSize]
readPrec :: ReadPrec EstimatedResourceSize
$creadPrec :: ReadPrec EstimatedResourceSize
readList :: ReadS [EstimatedResourceSize]
$creadList :: ReadS [EstimatedResourceSize]
readsPrec :: Int -> ReadS EstimatedResourceSize
$creadsPrec :: Int -> ReadS EstimatedResourceSize
Prelude.Read, Int -> EstimatedResourceSize -> ShowS
[EstimatedResourceSize] -> ShowS
EstimatedResourceSize -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EstimatedResourceSize] -> ShowS
$cshowList :: [EstimatedResourceSize] -> ShowS
show :: EstimatedResourceSize -> String
$cshow :: EstimatedResourceSize -> String
showsPrec :: Int -> EstimatedResourceSize -> ShowS
$cshowsPrec :: Int -> EstimatedResourceSize -> ShowS
Prelude.Show, forall x. Rep EstimatedResourceSize x -> EstimatedResourceSize
forall x. EstimatedResourceSize -> Rep EstimatedResourceSize x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EstimatedResourceSize x -> EstimatedResourceSize
$cfrom :: forall x. EstimatedResourceSize -> Rep EstimatedResourceSize x
Prelude.Generic)

-- |
-- Create a value of 'EstimatedResourceSize' 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:
--
-- 'estimatedOn', 'estimatedResourceSize_estimatedOn' - The time when the estimate of the size of the resource was made.
--
-- 'estimatedSizeInBytes', 'estimatedResourceSize_estimatedSizeInBytes' - The estimated size of the resource, in bytes.
newEstimatedResourceSize ::
  EstimatedResourceSize
newEstimatedResourceSize :: EstimatedResourceSize
newEstimatedResourceSize =
  EstimatedResourceSize'
    { $sel:estimatedOn:EstimatedResourceSize' :: Maybe POSIX
estimatedOn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedSizeInBytes:EstimatedResourceSize' :: Maybe Double
estimatedSizeInBytes = forall a. Maybe a
Prelude.Nothing
    }

-- | The time when the estimate of the size of the resource was made.
estimatedResourceSize_estimatedOn :: Lens.Lens' EstimatedResourceSize (Prelude.Maybe Prelude.UTCTime)
estimatedResourceSize_estimatedOn :: Lens' EstimatedResourceSize (Maybe UTCTime)
estimatedResourceSize_estimatedOn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EstimatedResourceSize' {Maybe POSIX
estimatedOn :: Maybe POSIX
$sel:estimatedOn:EstimatedResourceSize' :: EstimatedResourceSize -> Maybe POSIX
estimatedOn} -> Maybe POSIX
estimatedOn) (\s :: EstimatedResourceSize
s@EstimatedResourceSize' {} Maybe POSIX
a -> EstimatedResourceSize
s {$sel:estimatedOn:EstimatedResourceSize' :: Maybe POSIX
estimatedOn = Maybe POSIX
a} :: EstimatedResourceSize) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The estimated size of the resource, in bytes.
estimatedResourceSize_estimatedSizeInBytes :: Lens.Lens' EstimatedResourceSize (Prelude.Maybe Prelude.Double)
estimatedResourceSize_estimatedSizeInBytes :: Lens' EstimatedResourceSize (Maybe Double)
estimatedResourceSize_estimatedSizeInBytes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EstimatedResourceSize' {Maybe Double
estimatedSizeInBytes :: Maybe Double
$sel:estimatedSizeInBytes:EstimatedResourceSize' :: EstimatedResourceSize -> Maybe Double
estimatedSizeInBytes} -> Maybe Double
estimatedSizeInBytes) (\s :: EstimatedResourceSize
s@EstimatedResourceSize' {} Maybe Double
a -> EstimatedResourceSize
s {$sel:estimatedSizeInBytes:EstimatedResourceSize' :: Maybe Double
estimatedSizeInBytes = Maybe Double
a} :: EstimatedResourceSize)

instance Data.FromJSON EstimatedResourceSize where
  parseJSON :: Value -> Parser EstimatedResourceSize
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EstimatedResourceSize"
      ( \Object
x ->
          Maybe POSIX -> Maybe Double -> EstimatedResourceSize
EstimatedResourceSize'
            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
"estimatedOn")
            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
"estimatedSizeInBytes")
      )

instance Prelude.Hashable EstimatedResourceSize where
  hashWithSalt :: Int -> EstimatedResourceSize -> Int
hashWithSalt Int
_salt EstimatedResourceSize' {Maybe Double
Maybe POSIX
estimatedSizeInBytes :: Maybe Double
estimatedOn :: Maybe POSIX
$sel:estimatedSizeInBytes:EstimatedResourceSize' :: EstimatedResourceSize -> Maybe Double
$sel:estimatedOn:EstimatedResourceSize' :: EstimatedResourceSize -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
estimatedOn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
estimatedSizeInBytes

instance Prelude.NFData EstimatedResourceSize where
  rnf :: EstimatedResourceSize -> ()
rnf EstimatedResourceSize' {Maybe Double
Maybe POSIX
estimatedSizeInBytes :: Maybe Double
estimatedOn :: Maybe POSIX
$sel:estimatedSizeInBytes:EstimatedResourceSize' :: EstimatedResourceSize -> Maybe Double
$sel:estimatedOn:EstimatedResourceSize' :: EstimatedResourceSize -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
estimatedOn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
estimatedSizeInBytes