{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Chime.Types.Room 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

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

-- | The Amazon Chime account ID.
room_accountId :: Lens.Lens' Room (Prelude.Maybe Prelude.Text)
room_accountId :: Lens' Room (Maybe Text)
room_accountId = 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 identifier of the room creator.
room_createdBy :: Lens.Lens' Room (Prelude.Maybe Prelude.Text)
room_createdBy :: Lens' Room (Maybe Text)
room_createdBy = 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 room creation timestamp, in ISO 8601 format.
room_createdTimestamp :: Lens.Lens' Room (Prelude.Maybe Prelude.UTCTime)
room_createdTimestamp :: Lens' Room (Maybe UTCTime)
room_createdTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Room' {Maybe ISO8601
createdTimestamp :: Maybe ISO8601
$sel:createdTimestamp:Room' :: Room -> Maybe ISO8601
createdTimestamp} -> Maybe ISO8601
createdTimestamp) (\s :: Room
s@Room' {} Maybe ISO8601
a -> Room
s {$sel:createdTimestamp:Room' :: Maybe ISO8601
createdTimestamp = Maybe ISO8601
a} :: Room) 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 room name.
room_name :: Lens.Lens' Room (Prelude.Maybe Prelude.Text)
room_name :: Lens' Room (Maybe Text)
room_name = 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) 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. Iso' (Sensitive a) a
Data._Sensitive

-- | The room ID.
room_roomId :: Lens.Lens' Room (Prelude.Maybe Prelude.Text)
room_roomId :: Lens' Room (Maybe Text)
room_roomId = 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 update timestamp, in ISO 8601 format.
room_updatedTimestamp :: Lens.Lens' Room (Prelude.Maybe Prelude.UTCTime)
room_updatedTimestamp :: Lens' Room (Maybe UTCTime)
room_updatedTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Room' {Maybe ISO8601
updatedTimestamp :: Maybe ISO8601
$sel:updatedTimestamp:Room' :: Room -> Maybe ISO8601
updatedTimestamp} -> Maybe ISO8601
updatedTimestamp) (\s :: Room
s@Room' {} Maybe ISO8601
a -> Room
s {$sel:updatedTimestamp:Room' :: Maybe ISO8601
updatedTimestamp = Maybe ISO8601
a} :: Room) 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

instance Data.FromJSON Room where
  parseJSON :: Value -> Parser Room
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Room"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe ISO8601
-> Room
Room'
            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
"AccountId")
            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
"Name")
            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
"RoomId")
            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
"UpdatedTimestamp")
      )

instance Prelude.Hashable Room where
  hashWithSalt :: Int -> Room -> Int
hashWithSalt Int
_salt Room' {Maybe Text
Maybe (Sensitive Text)
Maybe ISO8601
updatedTimestamp :: Maybe ISO8601
roomId :: Maybe Text
name :: Maybe (Sensitive Text)
createdTimestamp :: Maybe ISO8601
createdBy :: Maybe Text
accountId :: Maybe Text
$sel:updatedTimestamp:Room' :: Room -> Maybe ISO8601
$sel:roomId:Room' :: Room -> Maybe Text
$sel:name:Room' :: Room -> Maybe (Sensitive Text)
$sel:createdTimestamp:Room' :: Room -> Maybe ISO8601
$sel:createdBy:Room' :: Room -> Maybe Text
$sel:accountId:Room' :: Room -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
createdBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
createdTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roomId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
updatedTimestamp

instance Prelude.NFData Room where
  rnf :: Room -> ()
rnf Room' {Maybe Text
Maybe (Sensitive Text)
Maybe ISO8601
updatedTimestamp :: Maybe ISO8601
roomId :: Maybe Text
name :: Maybe (Sensitive Text)
createdTimestamp :: Maybe ISO8601
createdBy :: Maybe Text
accountId :: Maybe Text
$sel:updatedTimestamp:Room' :: Room -> Maybe ISO8601
$sel:roomId:Room' :: Room -> Maybe Text
$sel:name:Room' :: Room -> Maybe (Sensitive Text)
$sel:createdTimestamp:Room' :: Room -> Maybe ISO8601
$sel:createdBy:Room' :: Room -> Maybe Text
$sel:accountId:Room' :: Room -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
createdBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
createdTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roomId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
updatedTimestamp