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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTAnalytics.Types.EstimatedResourceSize
import qualified Amazonka.Prelude as Prelude

-- | Statistics information about the channel.
--
-- /See:/ 'newChannelStatistics' smart constructor.
data ChannelStatistics = ChannelStatistics'
  { -- | The estimated size of the channel.
    ChannelStatistics -> Maybe EstimatedResourceSize
size :: Prelude.Maybe EstimatedResourceSize
  }
  deriving (ChannelStatistics -> ChannelStatistics -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelStatistics -> ChannelStatistics -> Bool
$c/= :: ChannelStatistics -> ChannelStatistics -> Bool
== :: ChannelStatistics -> ChannelStatistics -> Bool
$c== :: ChannelStatistics -> ChannelStatistics -> Bool
Prelude.Eq, ReadPrec [ChannelStatistics]
ReadPrec ChannelStatistics
Int -> ReadS ChannelStatistics
ReadS [ChannelStatistics]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelStatistics]
$creadListPrec :: ReadPrec [ChannelStatistics]
readPrec :: ReadPrec ChannelStatistics
$creadPrec :: ReadPrec ChannelStatistics
readList :: ReadS [ChannelStatistics]
$creadList :: ReadS [ChannelStatistics]
readsPrec :: Int -> ReadS ChannelStatistics
$creadsPrec :: Int -> ReadS ChannelStatistics
Prelude.Read, Int -> ChannelStatistics -> ShowS
[ChannelStatistics] -> ShowS
ChannelStatistics -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelStatistics] -> ShowS
$cshowList :: [ChannelStatistics] -> ShowS
show :: ChannelStatistics -> String
$cshow :: ChannelStatistics -> String
showsPrec :: Int -> ChannelStatistics -> ShowS
$cshowsPrec :: Int -> ChannelStatistics -> ShowS
Prelude.Show, forall x. Rep ChannelStatistics x -> ChannelStatistics
forall x. ChannelStatistics -> Rep ChannelStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelStatistics x -> ChannelStatistics
$cfrom :: forall x. ChannelStatistics -> Rep ChannelStatistics x
Prelude.Generic)

-- |
-- Create a value of 'ChannelStatistics' 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:
--
-- 'size', 'channelStatistics_size' - The estimated size of the channel.
newChannelStatistics ::
  ChannelStatistics
newChannelStatistics :: ChannelStatistics
newChannelStatistics =
  ChannelStatistics' {$sel:size:ChannelStatistics' :: Maybe EstimatedResourceSize
size = forall a. Maybe a
Prelude.Nothing}

-- | The estimated size of the channel.
channelStatistics_size :: Lens.Lens' ChannelStatistics (Prelude.Maybe EstimatedResourceSize)
channelStatistics_size :: Lens' ChannelStatistics (Maybe EstimatedResourceSize)
channelStatistics_size = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelStatistics' {Maybe EstimatedResourceSize
size :: Maybe EstimatedResourceSize
$sel:size:ChannelStatistics' :: ChannelStatistics -> Maybe EstimatedResourceSize
size} -> Maybe EstimatedResourceSize
size) (\s :: ChannelStatistics
s@ChannelStatistics' {} Maybe EstimatedResourceSize
a -> ChannelStatistics
s {$sel:size:ChannelStatistics' :: Maybe EstimatedResourceSize
size = Maybe EstimatedResourceSize
a} :: ChannelStatistics)

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

instance Prelude.Hashable ChannelStatistics where
  hashWithSalt :: Int -> ChannelStatistics -> Int
hashWithSalt Int
_salt ChannelStatistics' {Maybe EstimatedResourceSize
size :: Maybe EstimatedResourceSize
$sel:size:ChannelStatistics' :: ChannelStatistics -> Maybe EstimatedResourceSize
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EstimatedResourceSize
size

instance Prelude.NFData ChannelStatistics where
  rnf :: ChannelStatistics -> ()
rnf ChannelStatistics' {Maybe EstimatedResourceSize
size :: Maybe EstimatedResourceSize
$sel:size:ChannelStatistics' :: ChannelStatistics -> Maybe EstimatedResourceSize
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe EstimatedResourceSize
size