{-# 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.ChimeSDKMessaging.Types.SubChannelSummary
-- 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.ChimeSDKMessaging.Types.SubChannelSummary 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

-- | Summary of the sub-channels associated with the elastic channel.
--
-- /See:/ 'newSubChannelSummary' smart constructor.
data SubChannelSummary = SubChannelSummary'
  { -- | The number of members in a SubChannel.
    SubChannelSummary -> Maybe Int
membershipCount :: Prelude.Maybe Prelude.Int,
    -- | The unique ID of a SubChannel.
    SubChannelSummary -> Maybe Text
subChannelId :: Prelude.Maybe Prelude.Text
  }
  deriving (SubChannelSummary -> SubChannelSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubChannelSummary -> SubChannelSummary -> Bool
$c/= :: SubChannelSummary -> SubChannelSummary -> Bool
== :: SubChannelSummary -> SubChannelSummary -> Bool
$c== :: SubChannelSummary -> SubChannelSummary -> Bool
Prelude.Eq, ReadPrec [SubChannelSummary]
ReadPrec SubChannelSummary
Int -> ReadS SubChannelSummary
ReadS [SubChannelSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubChannelSummary]
$creadListPrec :: ReadPrec [SubChannelSummary]
readPrec :: ReadPrec SubChannelSummary
$creadPrec :: ReadPrec SubChannelSummary
readList :: ReadS [SubChannelSummary]
$creadList :: ReadS [SubChannelSummary]
readsPrec :: Int -> ReadS SubChannelSummary
$creadsPrec :: Int -> ReadS SubChannelSummary
Prelude.Read, Int -> SubChannelSummary -> ShowS
[SubChannelSummary] -> ShowS
SubChannelSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubChannelSummary] -> ShowS
$cshowList :: [SubChannelSummary] -> ShowS
show :: SubChannelSummary -> String
$cshow :: SubChannelSummary -> String
showsPrec :: Int -> SubChannelSummary -> ShowS
$cshowsPrec :: Int -> SubChannelSummary -> ShowS
Prelude.Show, forall x. Rep SubChannelSummary x -> SubChannelSummary
forall x. SubChannelSummary -> Rep SubChannelSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubChannelSummary x -> SubChannelSummary
$cfrom :: forall x. SubChannelSummary -> Rep SubChannelSummary x
Prelude.Generic)

-- |
-- Create a value of 'SubChannelSummary' 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:
--
-- 'membershipCount', 'subChannelSummary_membershipCount' - The number of members in a SubChannel.
--
-- 'subChannelId', 'subChannelSummary_subChannelId' - The unique ID of a SubChannel.
newSubChannelSummary ::
  SubChannelSummary
newSubChannelSummary :: SubChannelSummary
newSubChannelSummary =
  SubChannelSummary'
    { $sel:membershipCount:SubChannelSummary' :: Maybe Int
membershipCount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:subChannelId:SubChannelSummary' :: Maybe Text
subChannelId = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of members in a SubChannel.
subChannelSummary_membershipCount :: Lens.Lens' SubChannelSummary (Prelude.Maybe Prelude.Int)
subChannelSummary_membershipCount :: Lens' SubChannelSummary (Maybe Int)
subChannelSummary_membershipCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubChannelSummary' {Maybe Int
membershipCount :: Maybe Int
$sel:membershipCount:SubChannelSummary' :: SubChannelSummary -> Maybe Int
membershipCount} -> Maybe Int
membershipCount) (\s :: SubChannelSummary
s@SubChannelSummary' {} Maybe Int
a -> SubChannelSummary
s {$sel:membershipCount:SubChannelSummary' :: Maybe Int
membershipCount = Maybe Int
a} :: SubChannelSummary)

-- | The unique ID of a SubChannel.
subChannelSummary_subChannelId :: Lens.Lens' SubChannelSummary (Prelude.Maybe Prelude.Text)
subChannelSummary_subChannelId :: Lens' SubChannelSummary (Maybe Text)
subChannelSummary_subChannelId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubChannelSummary' {Maybe Text
subChannelId :: Maybe Text
$sel:subChannelId:SubChannelSummary' :: SubChannelSummary -> Maybe Text
subChannelId} -> Maybe Text
subChannelId) (\s :: SubChannelSummary
s@SubChannelSummary' {} Maybe Text
a -> SubChannelSummary
s {$sel:subChannelId:SubChannelSummary' :: Maybe Text
subChannelId = Maybe Text
a} :: SubChannelSummary)

instance Data.FromJSON SubChannelSummary where
  parseJSON :: Value -> Parser SubChannelSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SubChannelSummary"
      ( \Object
x ->
          Maybe Int -> Maybe Text -> SubChannelSummary
SubChannelSummary'
            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
"MembershipCount")
            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
"SubChannelId")
      )

instance Prelude.Hashable SubChannelSummary where
  hashWithSalt :: Int -> SubChannelSummary -> Int
hashWithSalt Int
_salt SubChannelSummary' {Maybe Int
Maybe Text
subChannelId :: Maybe Text
membershipCount :: Maybe Int
$sel:subChannelId:SubChannelSummary' :: SubChannelSummary -> Maybe Text
$sel:membershipCount:SubChannelSummary' :: SubChannelSummary -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
membershipCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subChannelId

instance Prelude.NFData SubChannelSummary where
  rnf :: SubChannelSummary -> ()
rnf SubChannelSummary' {Maybe Int
Maybe Text
subChannelId :: Maybe Text
membershipCount :: Maybe Int
$sel:subChannelId:SubChannelSummary' :: SubChannelSummary -> Maybe Text
$sel:membershipCount:SubChannelSummary' :: SubChannelSummary -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
membershipCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subChannelId