{-# 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.Chime.Types.ChannelSummary
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Chime.Types.ChannelSummary where

import Amazonka.Chime.Types.ChannelMode
import Amazonka.Chime.Types.ChannelPrivacy
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Summary of the details of a @Channel@.
--
-- /See:/ 'newChannelSummary' smart constructor.
data ChannelSummary = ChannelSummary'
  { -- | The mode of the channel.
    ChannelSummary -> Maybe ChannelMode
mode :: Prelude.Maybe ChannelMode,
    -- | The ARN of the channel.
    ChannelSummary -> Maybe Text
channelArn :: Prelude.Maybe Prelude.Text,
    -- | The privacy setting of the channel.
    ChannelSummary -> Maybe ChannelPrivacy
privacy :: Prelude.Maybe ChannelPrivacy,
    -- | The time at which the last message in a channel was sent.
    ChannelSummary -> Maybe POSIX
lastMessageTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The name of the channel.
    ChannelSummary -> Maybe (Sensitive Text)
name :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The metadata of the channel.
    ChannelSummary -> Maybe (Sensitive Text)
metadata :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (ChannelSummary -> ChannelSummary -> Bool
(ChannelSummary -> ChannelSummary -> Bool)
-> (ChannelSummary -> ChannelSummary -> Bool) -> Eq ChannelSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelSummary -> ChannelSummary -> Bool
$c/= :: ChannelSummary -> ChannelSummary -> Bool
== :: ChannelSummary -> ChannelSummary -> Bool
$c== :: ChannelSummary -> ChannelSummary -> Bool
Prelude.Eq, Int -> ChannelSummary -> ShowS
[ChannelSummary] -> ShowS
ChannelSummary -> String
(Int -> ChannelSummary -> ShowS)
-> (ChannelSummary -> String)
-> ([ChannelSummary] -> ShowS)
-> Show ChannelSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelSummary] -> ShowS
$cshowList :: [ChannelSummary] -> ShowS
show :: ChannelSummary -> String
$cshow :: ChannelSummary -> String
showsPrec :: Int -> ChannelSummary -> ShowS
$cshowsPrec :: Int -> ChannelSummary -> ShowS
Prelude.Show, (forall x. ChannelSummary -> Rep ChannelSummary x)
-> (forall x. Rep ChannelSummary x -> ChannelSummary)
-> Generic ChannelSummary
forall x. Rep ChannelSummary x -> ChannelSummary
forall x. ChannelSummary -> Rep ChannelSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelSummary x -> ChannelSummary
$cfrom :: forall x. ChannelSummary -> Rep ChannelSummary x
Prelude.Generic)

-- |
-- Create a value of 'ChannelSummary' 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:
--
-- 'mode', 'channelSummary_mode' - The mode of the channel.
--
-- 'channelArn', 'channelSummary_channelArn' - The ARN of the channel.
--
-- 'privacy', 'channelSummary_privacy' - The privacy setting of the channel.
--
-- 'lastMessageTimestamp', 'channelSummary_lastMessageTimestamp' - The time at which the last message in a channel was sent.
--
-- 'name', 'channelSummary_name' - The name of the channel.
--
-- 'metadata', 'channelSummary_metadata' - The metadata of the channel.
newChannelSummary ::
  ChannelSummary
newChannelSummary :: ChannelSummary
newChannelSummary =
  ChannelSummary' :: Maybe ChannelMode
-> Maybe Text
-> Maybe ChannelPrivacy
-> Maybe POSIX
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> ChannelSummary
ChannelSummary'
    { $sel:mode:ChannelSummary' :: Maybe ChannelMode
mode = Maybe ChannelMode
forall a. Maybe a
Prelude.Nothing,
      $sel:channelArn:ChannelSummary' :: Maybe Text
channelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:privacy:ChannelSummary' :: Maybe ChannelPrivacy
privacy = Maybe ChannelPrivacy
forall a. Maybe a
Prelude.Nothing,
      $sel:lastMessageTimestamp:ChannelSummary' :: Maybe POSIX
lastMessageTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ChannelSummary' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:metadata:ChannelSummary' :: Maybe (Sensitive Text)
metadata = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The mode of the channel.
channelSummary_mode :: Lens.Lens' ChannelSummary (Prelude.Maybe ChannelMode)
channelSummary_mode :: (Maybe ChannelMode -> f (Maybe ChannelMode))
-> ChannelSummary -> f ChannelSummary
channelSummary_mode = (ChannelSummary -> Maybe ChannelMode)
-> (ChannelSummary -> Maybe ChannelMode -> ChannelSummary)
-> Lens
     ChannelSummary
     ChannelSummary
     (Maybe ChannelMode)
     (Maybe ChannelMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSummary' {Maybe ChannelMode
mode :: Maybe ChannelMode
$sel:mode:ChannelSummary' :: ChannelSummary -> Maybe ChannelMode
mode} -> Maybe ChannelMode
mode) (\s :: ChannelSummary
s@ChannelSummary' {} Maybe ChannelMode
a -> ChannelSummary
s {$sel:mode:ChannelSummary' :: Maybe ChannelMode
mode = Maybe ChannelMode
a} :: ChannelSummary)

-- | The ARN of the channel.
channelSummary_channelArn :: Lens.Lens' ChannelSummary (Prelude.Maybe Prelude.Text)
channelSummary_channelArn :: (Maybe Text -> f (Maybe Text))
-> ChannelSummary -> f ChannelSummary
channelSummary_channelArn = (ChannelSummary -> Maybe Text)
-> (ChannelSummary -> Maybe Text -> ChannelSummary)
-> Lens ChannelSummary ChannelSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSummary' {Maybe Text
channelArn :: Maybe Text
$sel:channelArn:ChannelSummary' :: ChannelSummary -> Maybe Text
channelArn} -> Maybe Text
channelArn) (\s :: ChannelSummary
s@ChannelSummary' {} Maybe Text
a -> ChannelSummary
s {$sel:channelArn:ChannelSummary' :: Maybe Text
channelArn = Maybe Text
a} :: ChannelSummary)

-- | The privacy setting of the channel.
channelSummary_privacy :: Lens.Lens' ChannelSummary (Prelude.Maybe ChannelPrivacy)
channelSummary_privacy :: (Maybe ChannelPrivacy -> f (Maybe ChannelPrivacy))
-> ChannelSummary -> f ChannelSummary
channelSummary_privacy = (ChannelSummary -> Maybe ChannelPrivacy)
-> (ChannelSummary -> Maybe ChannelPrivacy -> ChannelSummary)
-> Lens
     ChannelSummary
     ChannelSummary
     (Maybe ChannelPrivacy)
     (Maybe ChannelPrivacy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSummary' {Maybe ChannelPrivacy
privacy :: Maybe ChannelPrivacy
$sel:privacy:ChannelSummary' :: ChannelSummary -> Maybe ChannelPrivacy
privacy} -> Maybe ChannelPrivacy
privacy) (\s :: ChannelSummary
s@ChannelSummary' {} Maybe ChannelPrivacy
a -> ChannelSummary
s {$sel:privacy:ChannelSummary' :: Maybe ChannelPrivacy
privacy = Maybe ChannelPrivacy
a} :: ChannelSummary)

-- | The time at which the last message in a channel was sent.
channelSummary_lastMessageTimestamp :: Lens.Lens' ChannelSummary (Prelude.Maybe Prelude.UTCTime)
channelSummary_lastMessageTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ChannelSummary -> f ChannelSummary
channelSummary_lastMessageTimestamp = (ChannelSummary -> Maybe POSIX)
-> (ChannelSummary -> Maybe POSIX -> ChannelSummary)
-> Lens ChannelSummary ChannelSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSummary' {Maybe POSIX
lastMessageTimestamp :: Maybe POSIX
$sel:lastMessageTimestamp:ChannelSummary' :: ChannelSummary -> Maybe POSIX
lastMessageTimestamp} -> Maybe POSIX
lastMessageTimestamp) (\s :: ChannelSummary
s@ChannelSummary' {} Maybe POSIX
a -> ChannelSummary
s {$sel:lastMessageTimestamp:ChannelSummary' :: Maybe POSIX
lastMessageTimestamp = Maybe POSIX
a} :: ChannelSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> ChannelSummary -> f ChannelSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ChannelSummary
-> f ChannelSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the channel.
channelSummary_name :: Lens.Lens' ChannelSummary (Prelude.Maybe Prelude.Text)
channelSummary_name :: (Maybe Text -> f (Maybe Text))
-> ChannelSummary -> f ChannelSummary
channelSummary_name = (ChannelSummary -> Maybe (Sensitive Text))
-> (ChannelSummary -> Maybe (Sensitive Text) -> ChannelSummary)
-> Lens
     ChannelSummary
     ChannelSummary
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSummary' {Maybe (Sensitive Text)
name :: Maybe (Sensitive Text)
$sel:name:ChannelSummary' :: ChannelSummary -> Maybe (Sensitive Text)
name} -> Maybe (Sensitive Text)
name) (\s :: ChannelSummary
s@ChannelSummary' {} Maybe (Sensitive Text)
a -> ChannelSummary
s {$sel:name:ChannelSummary' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
a} :: ChannelSummary) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ChannelSummary -> f ChannelSummary)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ChannelSummary
-> f ChannelSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The metadata of the channel.
channelSummary_metadata :: Lens.Lens' ChannelSummary (Prelude.Maybe Prelude.Text)
channelSummary_metadata :: (Maybe Text -> f (Maybe Text))
-> ChannelSummary -> f ChannelSummary
channelSummary_metadata = (ChannelSummary -> Maybe (Sensitive Text))
-> (ChannelSummary -> Maybe (Sensitive Text) -> ChannelSummary)
-> Lens
     ChannelSummary
     ChannelSummary
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSummary' {Maybe (Sensitive Text)
metadata :: Maybe (Sensitive Text)
$sel:metadata:ChannelSummary' :: ChannelSummary -> Maybe (Sensitive Text)
metadata} -> Maybe (Sensitive Text)
metadata) (\s :: ChannelSummary
s@ChannelSummary' {} Maybe (Sensitive Text)
a -> ChannelSummary
s {$sel:metadata:ChannelSummary' :: Maybe (Sensitive Text)
metadata = Maybe (Sensitive Text)
a} :: ChannelSummary) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ChannelSummary -> f ChannelSummary)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ChannelSummary
-> f ChannelSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.FromJSON ChannelSummary where
  parseJSON :: Value -> Parser ChannelSummary
parseJSON =
    String
-> (Object -> Parser ChannelSummary)
-> Value
-> Parser ChannelSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ChannelSummary"
      ( \Object
x ->
          Maybe ChannelMode
-> Maybe Text
-> Maybe ChannelPrivacy
-> Maybe POSIX
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> ChannelSummary
ChannelSummary'
            (Maybe ChannelMode
 -> Maybe Text
 -> Maybe ChannelPrivacy
 -> Maybe POSIX
 -> Maybe (Sensitive Text)
 -> Maybe (Sensitive Text)
 -> ChannelSummary)
-> Parser (Maybe ChannelMode)
-> Parser
     (Maybe Text
      -> Maybe ChannelPrivacy
      -> Maybe POSIX
      -> Maybe (Sensitive Text)
      -> Maybe (Sensitive Text)
      -> ChannelSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ChannelMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Mode")
            Parser
  (Maybe Text
   -> Maybe ChannelPrivacy
   -> Maybe POSIX
   -> Maybe (Sensitive Text)
   -> Maybe (Sensitive Text)
   -> ChannelSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe ChannelPrivacy
      -> Maybe POSIX
      -> Maybe (Sensitive Text)
      -> Maybe (Sensitive Text)
      -> ChannelSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ChannelArn")
            Parser
  (Maybe ChannelPrivacy
   -> Maybe POSIX
   -> Maybe (Sensitive Text)
   -> Maybe (Sensitive Text)
   -> ChannelSummary)
-> Parser (Maybe ChannelPrivacy)
-> Parser
     (Maybe POSIX
      -> Maybe (Sensitive Text)
      -> Maybe (Sensitive Text)
      -> ChannelSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ChannelPrivacy)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Privacy")
            Parser
  (Maybe POSIX
   -> Maybe (Sensitive Text)
   -> Maybe (Sensitive Text)
   -> ChannelSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe (Sensitive Text) -> ChannelSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastMessageTimestamp")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe (Sensitive Text) -> ChannelSummary)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe (Sensitive Text) -> ChannelSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe (Sensitive Text) -> ChannelSummary)
-> Parser (Maybe (Sensitive Text)) -> Parser ChannelSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Metadata")
      )

instance Prelude.Hashable ChannelSummary

instance Prelude.NFData ChannelSummary