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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The Amazon Chime chat room details.
--
-- /See:/ 'newRoom' smart constructor.
data Room = Room'
  { -- | The room update timestamp, in ISO 8601 format.
    Room -> Maybe POSIX
updatedTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The identifier of the room creator.
    Room -> Maybe Text
createdBy :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Chime account ID.
    Room -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The room name.
    Room -> Maybe (Sensitive Text)
name :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The room ID.
    Room -> Maybe Text
roomId :: Prelude.Maybe Prelude.Text,
    -- | The room creation timestamp, in ISO 8601 format.
    Room -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Core.POSIX
  }
  deriving (Room -> Room -> Bool
(Room -> Room -> Bool) -> (Room -> Room -> Bool) -> Eq Room
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Room -> Room -> Bool
$c/= :: Room -> Room -> Bool
== :: Room -> Room -> Bool
$c== :: Room -> Room -> Bool
Prelude.Eq, Int -> Room -> ShowS
[Room] -> ShowS
Room -> String
(Int -> Room -> ShowS)
-> (Room -> String) -> ([Room] -> ShowS) -> Show Room
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Room] -> ShowS
$cshowList :: [Room] -> ShowS
show :: Room -> String
$cshow :: Room -> String
showsPrec :: Int -> Room -> ShowS
$cshowsPrec :: Int -> Room -> ShowS
Prelude.Show, (forall x. Room -> Rep Room x)
-> (forall x. Rep Room x -> Room) -> Generic Room
forall x. Rep Room x -> Room
forall x. Room -> Rep Room x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Room x -> Room
$cfrom :: forall x. Room -> Rep Room x
Prelude.Generic)

-- |
-- Create a value of 'Room' 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:
--
-- 'updatedTimestamp', 'room_updatedTimestamp' - The room update timestamp, in ISO 8601 format.
--
-- 'createdBy', 'room_createdBy' - The identifier of the room creator.
--
-- 'accountId', 'room_accountId' - The Amazon Chime account ID.
--
-- 'name', 'room_name' - The room name.
--
-- 'roomId', 'room_roomId' - The room ID.
--
-- 'createdTimestamp', 'room_createdTimestamp' - The room creation timestamp, in ISO 8601 format.
newRoom ::
  Room
newRoom :: Room
newRoom =
  Room' :: Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe POSIX
-> Room
Room'
    { $sel:updatedTimestamp:Room' :: Maybe POSIX
updatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:createdBy:Room' :: Maybe Text
createdBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:Room' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Room' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:roomId:Room' :: Maybe Text
roomId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:Room' :: Maybe POSIX
createdTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The room update timestamp, in ISO 8601 format.
room_updatedTimestamp :: Lens.Lens' Room (Prelude.Maybe Prelude.UTCTime)
room_updatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Room -> f Room
room_updatedTimestamp = (Room -> Maybe POSIX)
-> (Room -> Maybe POSIX -> Room)
-> Lens Room Room (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Room' {Maybe POSIX
updatedTimestamp :: Maybe POSIX
$sel:updatedTimestamp:Room' :: Room -> Maybe POSIX
updatedTimestamp} -> Maybe POSIX
updatedTimestamp) (\s :: Room
s@Room' {} Maybe POSIX
a -> Room
s {$sel:updatedTimestamp:Room' :: Maybe POSIX
updatedTimestamp = Maybe POSIX
a} :: Room) ((Maybe POSIX -> f (Maybe POSIX)) -> Room -> f Room)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Room
-> f Room
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 identifier of the room creator.
room_createdBy :: Lens.Lens' Room (Prelude.Maybe Prelude.Text)
room_createdBy :: (Maybe Text -> f (Maybe Text)) -> Room -> f Room
room_createdBy = (Room -> Maybe Text)
-> (Room -> Maybe Text -> Room)
-> Lens Room Room (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Room' {Maybe Text
createdBy :: Maybe Text
$sel:createdBy:Room' :: Room -> Maybe Text
createdBy} -> Maybe Text
createdBy) (\s :: Room
s@Room' {} Maybe Text
a -> Room
s {$sel:createdBy:Room' :: Maybe Text
createdBy = Maybe Text
a} :: Room)

-- | The Amazon Chime account ID.
room_accountId :: Lens.Lens' Room (Prelude.Maybe Prelude.Text)
room_accountId :: (Maybe Text -> f (Maybe Text)) -> Room -> f Room
room_accountId = (Room -> Maybe Text)
-> (Room -> Maybe Text -> Room)
-> Lens Room Room (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Room' {Maybe Text
accountId :: Maybe Text
$sel:accountId:Room' :: Room -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: Room
s@Room' {} Maybe Text
a -> Room
s {$sel:accountId:Room' :: Maybe Text
accountId = Maybe Text
a} :: Room)

-- | The room name.
room_name :: Lens.Lens' Room (Prelude.Maybe Prelude.Text)
room_name :: (Maybe Text -> f (Maybe Text)) -> Room -> f Room
room_name = (Room -> Maybe (Sensitive Text))
-> (Room -> Maybe (Sensitive Text) -> Room)
-> Lens Room Room (Maybe (Sensitive Text)) (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Room' {Maybe (Sensitive Text)
name :: Maybe (Sensitive Text)
$sel:name:Room' :: Room -> Maybe (Sensitive Text)
name} -> Maybe (Sensitive Text)
name) (\s :: Room
s@Room' {} Maybe (Sensitive Text)
a -> Room
s {$sel:name:Room' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
a} :: Room) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> Room -> f Room)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Room
-> f Room
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 room ID.
room_roomId :: Lens.Lens' Room (Prelude.Maybe Prelude.Text)
room_roomId :: (Maybe Text -> f (Maybe Text)) -> Room -> f Room
room_roomId = (Room -> Maybe Text)
-> (Room -> Maybe Text -> Room)
-> Lens Room Room (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Room' {Maybe Text
roomId :: Maybe Text
$sel:roomId:Room' :: Room -> Maybe Text
roomId} -> Maybe Text
roomId) (\s :: Room
s@Room' {} Maybe Text
a -> Room
s {$sel:roomId:Room' :: Maybe Text
roomId = Maybe Text
a} :: Room)

-- | The room creation timestamp, in ISO 8601 format.
room_createdTimestamp :: Lens.Lens' Room (Prelude.Maybe Prelude.UTCTime)
room_createdTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Room -> f Room
room_createdTimestamp = (Room -> Maybe POSIX)
-> (Room -> Maybe POSIX -> Room)
-> Lens Room Room (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Room' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:Room' :: Room -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: Room
s@Room' {} Maybe POSIX
a -> Room
s {$sel:createdTimestamp:Room' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: Room) ((Maybe POSIX -> f (Maybe POSIX)) -> Room -> f Room)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Room
-> f Room
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

instance Core.FromJSON Room where
  parseJSON :: Value -> Parser Room
parseJSON =
    String -> (Object -> Parser Room) -> Value -> Parser Room
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Room"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe POSIX
-> Room
Room'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe (Sensitive Text)
 -> Maybe Text
 -> Maybe POSIX
 -> Room)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe Text
      -> Maybe POSIX
      -> Room)
forall (f :: * -> *) a b. Functor 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
"UpdatedTimestamp")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe Text
   -> Maybe POSIX
   -> Room)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (Sensitive Text) -> Maybe Text -> Maybe POSIX -> Room)
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
"CreatedBy")
            Parser
  (Maybe Text
   -> Maybe (Sensitive Text) -> Maybe Text -> Maybe POSIX -> Room)
-> Parser (Maybe Text)
-> Parser
     (Maybe (Sensitive Text) -> Maybe Text -> Maybe POSIX -> Room)
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
"AccountId")
            Parser
  (Maybe (Sensitive Text) -> Maybe Text -> Maybe POSIX -> Room)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe Text -> Maybe POSIX -> Room)
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 Text -> Maybe POSIX -> Room)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> Room)
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
"RoomId")
            Parser (Maybe POSIX -> Room) -> Parser (Maybe POSIX) -> Parser Room
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
"CreatedTimestamp")
      )

instance Prelude.Hashable Room

instance Prelude.NFData Room