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

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

-- | An Amazon Chime SDK meeting attendee. Includes a unique @AttendeeId@ and
-- @JoinToken@ . The @JoinToken@ allows a client to authenticate and join
-- as the specified attendee. The @JoinToken@ expires when the meeting ends
-- or when DeleteAttendee is called. After that, the attendee is unable to
-- join the meeting.
--
-- We recommend securely transferring each @JoinToken@ from your server
-- application to the client so that no other client has access to the
-- token except for the one authorized to represent the attendee.
--
-- /See:/ 'newAttendee' smart constructor.
data Attendee = Attendee'
  { -- | The Amazon Chime SDK attendee ID.
    Attendee -> Maybe Text
attendeeId :: Prelude.Maybe Prelude.Text,
    -- | The join token used by the Amazon Chime SDK attendee.
    Attendee -> Maybe (Sensitive Text)
joinToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The Amazon Chime SDK external user ID. An idempotency token. Links the
    -- attendee to an identity managed by a builder application.
    Attendee -> Maybe (Sensitive Text)
externalUserId :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (Attendee -> Attendee -> Bool
(Attendee -> Attendee -> Bool)
-> (Attendee -> Attendee -> Bool) -> Eq Attendee
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Attendee -> Attendee -> Bool
$c/= :: Attendee -> Attendee -> Bool
== :: Attendee -> Attendee -> Bool
$c== :: Attendee -> Attendee -> Bool
Prelude.Eq, Int -> Attendee -> ShowS
[Attendee] -> ShowS
Attendee -> String
(Int -> Attendee -> ShowS)
-> (Attendee -> String) -> ([Attendee] -> ShowS) -> Show Attendee
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Attendee] -> ShowS
$cshowList :: [Attendee] -> ShowS
show :: Attendee -> String
$cshow :: Attendee -> String
showsPrec :: Int -> Attendee -> ShowS
$cshowsPrec :: Int -> Attendee -> ShowS
Prelude.Show, (forall x. Attendee -> Rep Attendee x)
-> (forall x. Rep Attendee x -> Attendee) -> Generic Attendee
forall x. Rep Attendee x -> Attendee
forall x. Attendee -> Rep Attendee x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Attendee x -> Attendee
$cfrom :: forall x. Attendee -> Rep Attendee x
Prelude.Generic)

-- |
-- Create a value of 'Attendee' 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:
--
-- 'attendeeId', 'attendee_attendeeId' - The Amazon Chime SDK attendee ID.
--
-- 'joinToken', 'attendee_joinToken' - The join token used by the Amazon Chime SDK attendee.
--
-- 'externalUserId', 'attendee_externalUserId' - The Amazon Chime SDK external user ID. An idempotency token. Links the
-- attendee to an identity managed by a builder application.
newAttendee ::
  Attendee
newAttendee :: Attendee
newAttendee =
  Attendee' :: Maybe Text
-> Maybe (Sensitive Text) -> Maybe (Sensitive Text) -> Attendee
Attendee'
    { $sel:attendeeId:Attendee' :: Maybe Text
attendeeId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:joinToken:Attendee' :: Maybe (Sensitive Text)
joinToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:externalUserId:Attendee' :: Maybe (Sensitive Text)
externalUserId = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Chime SDK attendee ID.
attendee_attendeeId :: Lens.Lens' Attendee (Prelude.Maybe Prelude.Text)
attendee_attendeeId :: (Maybe Text -> f (Maybe Text)) -> Attendee -> f Attendee
attendee_attendeeId = (Attendee -> Maybe Text)
-> (Attendee -> Maybe Text -> Attendee)
-> Lens Attendee Attendee (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attendee' {Maybe Text
attendeeId :: Maybe Text
$sel:attendeeId:Attendee' :: Attendee -> Maybe Text
attendeeId} -> Maybe Text
attendeeId) (\s :: Attendee
s@Attendee' {} Maybe Text
a -> Attendee
s {$sel:attendeeId:Attendee' :: Maybe Text
attendeeId = Maybe Text
a} :: Attendee)

-- | The join token used by the Amazon Chime SDK attendee.
attendee_joinToken :: Lens.Lens' Attendee (Prelude.Maybe Prelude.Text)
attendee_joinToken :: (Maybe Text -> f (Maybe Text)) -> Attendee -> f Attendee
attendee_joinToken = (Attendee -> Maybe (Sensitive Text))
-> (Attendee -> Maybe (Sensitive Text) -> Attendee)
-> Lens
     Attendee Attendee (Maybe (Sensitive Text)) (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attendee' {Maybe (Sensitive Text)
joinToken :: Maybe (Sensitive Text)
$sel:joinToken:Attendee' :: Attendee -> Maybe (Sensitive Text)
joinToken} -> Maybe (Sensitive Text)
joinToken) (\s :: Attendee
s@Attendee' {} Maybe (Sensitive Text)
a -> Attendee
s {$sel:joinToken:Attendee' :: Maybe (Sensitive Text)
joinToken = Maybe (Sensitive Text)
a} :: Attendee) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> Attendee -> f Attendee)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Attendee
-> f Attendee
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 Amazon Chime SDK external user ID. An idempotency token. Links the
-- attendee to an identity managed by a builder application.
attendee_externalUserId :: Lens.Lens' Attendee (Prelude.Maybe Prelude.Text)
attendee_externalUserId :: (Maybe Text -> f (Maybe Text)) -> Attendee -> f Attendee
attendee_externalUserId = (Attendee -> Maybe (Sensitive Text))
-> (Attendee -> Maybe (Sensitive Text) -> Attendee)
-> Lens
     Attendee Attendee (Maybe (Sensitive Text)) (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attendee' {Maybe (Sensitive Text)
externalUserId :: Maybe (Sensitive Text)
$sel:externalUserId:Attendee' :: Attendee -> Maybe (Sensitive Text)
externalUserId} -> Maybe (Sensitive Text)
externalUserId) (\s :: Attendee
s@Attendee' {} Maybe (Sensitive Text)
a -> Attendee
s {$sel:externalUserId:Attendee' :: Maybe (Sensitive Text)
externalUserId = Maybe (Sensitive Text)
a} :: Attendee) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> Attendee -> f Attendee)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Attendee
-> f Attendee
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 Attendee where
  parseJSON :: Value -> Parser Attendee
parseJSON =
    String -> (Object -> Parser Attendee) -> Value -> Parser Attendee
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Attendee"
      ( \Object
x ->
          Maybe Text
-> Maybe (Sensitive Text) -> Maybe (Sensitive Text) -> Attendee
Attendee'
            (Maybe Text
 -> Maybe (Sensitive Text) -> Maybe (Sensitive Text) -> Attendee)
-> Parser (Maybe Text)
-> Parser
     (Maybe (Sensitive Text) -> Maybe (Sensitive Text) -> Attendee)
forall (f :: * -> *) a b. Functor 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
"AttendeeId")
            Parser
  (Maybe (Sensitive Text) -> Maybe (Sensitive Text) -> Attendee)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe (Sensitive Text) -> Attendee)
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
"JoinToken")
            Parser (Maybe (Sensitive Text) -> Attendee)
-> Parser (Maybe (Sensitive Text)) -> Parser Attendee
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
"ExternalUserId")
      )

instance Prelude.Hashable Attendee

instance Prelude.NFData Attendee