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

import Amazonka.Chime.Types.Tag
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The Amazon Chime SDK attendee fields to create, used with the
-- BatchCreateAttendee action.
--
-- /See:/ 'newCreateAttendeeRequestItem' smart constructor.
data CreateAttendeeRequestItem = CreateAttendeeRequestItem'
  { -- | The tag key-value pairs.
    CreateAttendeeRequestItem -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The Amazon Chime SDK external user ID. An idempotency token. Links the
    -- attendee to an identity managed by a builder application.
    CreateAttendeeRequestItem -> Sensitive Text
externalUserId :: Core.Sensitive Prelude.Text
  }
  deriving (CreateAttendeeRequestItem -> CreateAttendeeRequestItem -> Bool
(CreateAttendeeRequestItem -> CreateAttendeeRequestItem -> Bool)
-> (CreateAttendeeRequestItem -> CreateAttendeeRequestItem -> Bool)
-> Eq CreateAttendeeRequestItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAttendeeRequestItem -> CreateAttendeeRequestItem -> Bool
$c/= :: CreateAttendeeRequestItem -> CreateAttendeeRequestItem -> Bool
== :: CreateAttendeeRequestItem -> CreateAttendeeRequestItem -> Bool
$c== :: CreateAttendeeRequestItem -> CreateAttendeeRequestItem -> Bool
Prelude.Eq, Int -> CreateAttendeeRequestItem -> ShowS
[CreateAttendeeRequestItem] -> ShowS
CreateAttendeeRequestItem -> String
(Int -> CreateAttendeeRequestItem -> ShowS)
-> (CreateAttendeeRequestItem -> String)
-> ([CreateAttendeeRequestItem] -> ShowS)
-> Show CreateAttendeeRequestItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAttendeeRequestItem] -> ShowS
$cshowList :: [CreateAttendeeRequestItem] -> ShowS
show :: CreateAttendeeRequestItem -> String
$cshow :: CreateAttendeeRequestItem -> String
showsPrec :: Int -> CreateAttendeeRequestItem -> ShowS
$cshowsPrec :: Int -> CreateAttendeeRequestItem -> ShowS
Prelude.Show, (forall x.
 CreateAttendeeRequestItem -> Rep CreateAttendeeRequestItem x)
-> (forall x.
    Rep CreateAttendeeRequestItem x -> CreateAttendeeRequestItem)
-> Generic CreateAttendeeRequestItem
forall x.
Rep CreateAttendeeRequestItem x -> CreateAttendeeRequestItem
forall x.
CreateAttendeeRequestItem -> Rep CreateAttendeeRequestItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAttendeeRequestItem x -> CreateAttendeeRequestItem
$cfrom :: forall x.
CreateAttendeeRequestItem -> Rep CreateAttendeeRequestItem x
Prelude.Generic)

-- |
-- Create a value of 'CreateAttendeeRequestItem' 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:
--
-- 'tags', 'createAttendeeRequestItem_tags' - The tag key-value pairs.
--
-- 'externalUserId', 'createAttendeeRequestItem_externalUserId' - The Amazon Chime SDK external user ID. An idempotency token. Links the
-- attendee to an identity managed by a builder application.
newCreateAttendeeRequestItem ::
  -- | 'externalUserId'
  Prelude.Text ->
  CreateAttendeeRequestItem
newCreateAttendeeRequestItem :: Text -> CreateAttendeeRequestItem
newCreateAttendeeRequestItem Text
pExternalUserId_ =
  CreateAttendeeRequestItem' :: Maybe (NonEmpty Tag) -> Sensitive Text -> CreateAttendeeRequestItem
CreateAttendeeRequestItem'
    { $sel:tags:CreateAttendeeRequestItem' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
      $sel:externalUserId:CreateAttendeeRequestItem' :: Sensitive Text
externalUserId =
        Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pExternalUserId_
    }

-- | The tag key-value pairs.
createAttendeeRequestItem_tags :: Lens.Lens' CreateAttendeeRequestItem (Prelude.Maybe (Prelude.NonEmpty Tag))
createAttendeeRequestItem_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateAttendeeRequestItem -> f CreateAttendeeRequestItem
createAttendeeRequestItem_tags = (CreateAttendeeRequestItem -> Maybe (NonEmpty Tag))
-> (CreateAttendeeRequestItem
    -> Maybe (NonEmpty Tag) -> CreateAttendeeRequestItem)
-> Lens
     CreateAttendeeRequestItem
     CreateAttendeeRequestItem
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAttendeeRequestItem' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateAttendeeRequestItem' :: CreateAttendeeRequestItem -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateAttendeeRequestItem
s@CreateAttendeeRequestItem' {} Maybe (NonEmpty Tag)
a -> CreateAttendeeRequestItem
s {$sel:tags:CreateAttendeeRequestItem' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateAttendeeRequestItem) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> CreateAttendeeRequestItem -> f CreateAttendeeRequestItem)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateAttendeeRequestItem
-> f CreateAttendeeRequestItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
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 (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Chime SDK external user ID. An idempotency token. Links the
-- attendee to an identity managed by a builder application.
createAttendeeRequestItem_externalUserId :: Lens.Lens' CreateAttendeeRequestItem Prelude.Text
createAttendeeRequestItem_externalUserId :: (Text -> f Text)
-> CreateAttendeeRequestItem -> f CreateAttendeeRequestItem
createAttendeeRequestItem_externalUserId = (CreateAttendeeRequestItem -> Sensitive Text)
-> (CreateAttendeeRequestItem
    -> Sensitive Text -> CreateAttendeeRequestItem)
-> Lens
     CreateAttendeeRequestItem
     CreateAttendeeRequestItem
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAttendeeRequestItem' {Sensitive Text
externalUserId :: Sensitive Text
$sel:externalUserId:CreateAttendeeRequestItem' :: CreateAttendeeRequestItem -> Sensitive Text
externalUserId} -> Sensitive Text
externalUserId) (\s :: CreateAttendeeRequestItem
s@CreateAttendeeRequestItem' {} Sensitive Text
a -> CreateAttendeeRequestItem
s {$sel:externalUserId:CreateAttendeeRequestItem' :: Sensitive Text
externalUserId = Sensitive Text
a} :: CreateAttendeeRequestItem) ((Sensitive Text -> f (Sensitive Text))
 -> CreateAttendeeRequestItem -> f CreateAttendeeRequestItem)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateAttendeeRequestItem
-> f CreateAttendeeRequestItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Prelude.Hashable CreateAttendeeRequestItem

instance Prelude.NFData CreateAttendeeRequestItem

instance Core.ToJSON CreateAttendeeRequestItem where
  toJSON :: CreateAttendeeRequestItem -> Value
toJSON CreateAttendeeRequestItem' {Maybe (NonEmpty Tag)
Sensitive Text
externalUserId :: Sensitive Text
tags :: Maybe (NonEmpty Tag)
$sel:externalUserId:CreateAttendeeRequestItem' :: CreateAttendeeRequestItem -> Sensitive Text
$sel:tags:CreateAttendeeRequestItem' :: CreateAttendeeRequestItem -> Maybe (NonEmpty Tag)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Tag -> Pair) -> Maybe (NonEmpty Tag) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ExternalUserId" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
externalUserId)
          ]
      )