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

import Amazonka.ChimeSDKMessaging.Types.Identity
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 details of a channel moderator.
--
-- /See:/ 'newChannelModerator' smart constructor.
data ChannelModerator = ChannelModerator'
  { -- | The ARN of the moderator\'s channel.
    ChannelModerator -> Maybe Text
channelArn :: Prelude.Maybe Prelude.Text,
    -- | The @AppInstanceUser@ who created the moderator.
    ChannelModerator -> Maybe Identity
createdBy :: Prelude.Maybe Identity,
    -- | The time at which the moderator was created.
    ChannelModerator -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The moderator\'s data.
    ChannelModerator -> Maybe Identity
moderator :: Prelude.Maybe Identity
  }
  deriving (ChannelModerator -> ChannelModerator -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelModerator -> ChannelModerator -> Bool
$c/= :: ChannelModerator -> ChannelModerator -> Bool
== :: ChannelModerator -> ChannelModerator -> Bool
$c== :: ChannelModerator -> ChannelModerator -> Bool
Prelude.Eq, Int -> ChannelModerator -> ShowS
[ChannelModerator] -> ShowS
ChannelModerator -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelModerator] -> ShowS
$cshowList :: [ChannelModerator] -> ShowS
show :: ChannelModerator -> String
$cshow :: ChannelModerator -> String
showsPrec :: Int -> ChannelModerator -> ShowS
$cshowsPrec :: Int -> ChannelModerator -> ShowS
Prelude.Show, forall x. Rep ChannelModerator x -> ChannelModerator
forall x. ChannelModerator -> Rep ChannelModerator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelModerator x -> ChannelModerator
$cfrom :: forall x. ChannelModerator -> Rep ChannelModerator x
Prelude.Generic)

-- |
-- Create a value of 'ChannelModerator' 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:
--
-- 'channelArn', 'channelModerator_channelArn' - The ARN of the moderator\'s channel.
--
-- 'createdBy', 'channelModerator_createdBy' - The @AppInstanceUser@ who created the moderator.
--
-- 'createdTimestamp', 'channelModerator_createdTimestamp' - The time at which the moderator was created.
--
-- 'moderator', 'channelModerator_moderator' - The moderator\'s data.
newChannelModerator ::
  ChannelModerator
newChannelModerator :: ChannelModerator
newChannelModerator =
  ChannelModerator'
    { $sel:channelArn:ChannelModerator' :: Maybe Text
channelArn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdBy:ChannelModerator' :: Maybe Identity
createdBy = forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:ChannelModerator' :: Maybe POSIX
createdTimestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:moderator:ChannelModerator' :: Maybe Identity
moderator = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The @AppInstanceUser@ who created the moderator.
channelModerator_createdBy :: Lens.Lens' ChannelModerator (Prelude.Maybe Identity)
channelModerator_createdBy :: Lens' ChannelModerator (Maybe Identity)
channelModerator_createdBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelModerator' {Maybe Identity
createdBy :: Maybe Identity
$sel:createdBy:ChannelModerator' :: ChannelModerator -> Maybe Identity
createdBy} -> Maybe Identity
createdBy) (\s :: ChannelModerator
s@ChannelModerator' {} Maybe Identity
a -> ChannelModerator
s {$sel:createdBy:ChannelModerator' :: Maybe Identity
createdBy = Maybe Identity
a} :: ChannelModerator)

-- | The time at which the moderator was created.
channelModerator_createdTimestamp :: Lens.Lens' ChannelModerator (Prelude.Maybe Prelude.UTCTime)
channelModerator_createdTimestamp :: Lens' ChannelModerator (Maybe UTCTime)
channelModerator_createdTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelModerator' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:ChannelModerator' :: ChannelModerator -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: ChannelModerator
s@ChannelModerator' {} Maybe POSIX
a -> ChannelModerator
s {$sel:createdTimestamp:ChannelModerator' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: ChannelModerator) 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 moderator\'s data.
channelModerator_moderator :: Lens.Lens' ChannelModerator (Prelude.Maybe Identity)
channelModerator_moderator :: Lens' ChannelModerator (Maybe Identity)
channelModerator_moderator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelModerator' {Maybe Identity
moderator :: Maybe Identity
$sel:moderator:ChannelModerator' :: ChannelModerator -> Maybe Identity
moderator} -> Maybe Identity
moderator) (\s :: ChannelModerator
s@ChannelModerator' {} Maybe Identity
a -> ChannelModerator
s {$sel:moderator:ChannelModerator' :: Maybe Identity
moderator = Maybe Identity
a} :: ChannelModerator)

instance Data.FromJSON ChannelModerator where
  parseJSON :: Value -> Parser ChannelModerator
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ChannelModerator"
      ( \Object
x ->
          Maybe Text
-> Maybe Identity
-> Maybe POSIX
-> Maybe Identity
-> ChannelModerator
ChannelModerator'
            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
"ChannelArn")
            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
"CreatedBy")
            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
"CreatedTimestamp")
            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
"Moderator")
      )

instance Prelude.Hashable ChannelModerator where
  hashWithSalt :: Int -> ChannelModerator -> Int
hashWithSalt Int
_salt ChannelModerator' {Maybe Text
Maybe POSIX
Maybe Identity
moderator :: Maybe Identity
createdTimestamp :: Maybe POSIX
createdBy :: Maybe Identity
channelArn :: Maybe Text
$sel:moderator:ChannelModerator' :: ChannelModerator -> Maybe Identity
$sel:createdTimestamp:ChannelModerator' :: ChannelModerator -> Maybe POSIX
$sel:createdBy:ChannelModerator' :: ChannelModerator -> Maybe Identity
$sel:channelArn:ChannelModerator' :: ChannelModerator -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
channelArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Identity
createdBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Identity
moderator

instance Prelude.NFData ChannelModerator where
  rnf :: ChannelModerator -> ()
rnf ChannelModerator' {Maybe Text
Maybe POSIX
Maybe Identity
moderator :: Maybe Identity
createdTimestamp :: Maybe POSIX
createdBy :: Maybe Identity
channelArn :: Maybe Text
$sel:moderator:ChannelModerator' :: ChannelModerator -> Maybe Identity
$sel:createdTimestamp:ChannelModerator' :: ChannelModerator -> Maybe POSIX
$sel:createdBy:ChannelModerator' :: ChannelModerator -> Maybe Identity
$sel:channelArn:ChannelModerator' :: ChannelModerator -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
channelArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Identity
createdBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Identity
moderator