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

import Amazonka.Chime.Types.EmailStatus
import Amazonka.Chime.Types.InviteStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Invitation object returned after emailing users to invite them to join
-- the Amazon Chime @Team@ account.
--
-- /See:/ 'newInvite' smart constructor.
data Invite = Invite'
  { -- | The status of the invite.
    Invite -> Maybe InviteStatus
status :: Prelude.Maybe InviteStatus,
    -- | The status of the invite email.
    Invite -> Maybe EmailStatus
emailStatus :: Prelude.Maybe EmailStatus,
    -- | The invite ID.
    Invite -> Maybe Text
inviteId :: Prelude.Maybe Prelude.Text,
    -- | The email address to which the invite is sent.
    Invite -> Maybe (Sensitive Text)
emailAddress :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (Invite -> Invite -> Bool
(Invite -> Invite -> Bool)
-> (Invite -> Invite -> Bool) -> Eq Invite
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Invite -> Invite -> Bool
$c/= :: Invite -> Invite -> Bool
== :: Invite -> Invite -> Bool
$c== :: Invite -> Invite -> Bool
Prelude.Eq, Int -> Invite -> ShowS
[Invite] -> ShowS
Invite -> String
(Int -> Invite -> ShowS)
-> (Invite -> String) -> ([Invite] -> ShowS) -> Show Invite
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Invite] -> ShowS
$cshowList :: [Invite] -> ShowS
show :: Invite -> String
$cshow :: Invite -> String
showsPrec :: Int -> Invite -> ShowS
$cshowsPrec :: Int -> Invite -> ShowS
Prelude.Show, (forall x. Invite -> Rep Invite x)
-> (forall x. Rep Invite x -> Invite) -> Generic Invite
forall x. Rep Invite x -> Invite
forall x. Invite -> Rep Invite x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Invite x -> Invite
$cfrom :: forall x. Invite -> Rep Invite x
Prelude.Generic)

-- |
-- Create a value of 'Invite' 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:
--
-- 'status', 'invite_status' - The status of the invite.
--
-- 'emailStatus', 'invite_emailStatus' - The status of the invite email.
--
-- 'inviteId', 'invite_inviteId' - The invite ID.
--
-- 'emailAddress', 'invite_emailAddress' - The email address to which the invite is sent.
newInvite ::
  Invite
newInvite :: Invite
newInvite =
  Invite' :: Maybe InviteStatus
-> Maybe EmailStatus
-> Maybe Text
-> Maybe (Sensitive Text)
-> Invite
Invite'
    { $sel:status:Invite' :: Maybe InviteStatus
status = Maybe InviteStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:emailStatus:Invite' :: Maybe EmailStatus
emailStatus = Maybe EmailStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:inviteId:Invite' :: Maybe Text
inviteId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:emailAddress:Invite' :: Maybe (Sensitive Text)
emailAddress = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the invite.
invite_status :: Lens.Lens' Invite (Prelude.Maybe InviteStatus)
invite_status :: (Maybe InviteStatus -> f (Maybe InviteStatus))
-> Invite -> f Invite
invite_status = (Invite -> Maybe InviteStatus)
-> (Invite -> Maybe InviteStatus -> Invite)
-> Lens Invite Invite (Maybe InviteStatus) (Maybe InviteStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Invite' {Maybe InviteStatus
status :: Maybe InviteStatus
$sel:status:Invite' :: Invite -> Maybe InviteStatus
status} -> Maybe InviteStatus
status) (\s :: Invite
s@Invite' {} Maybe InviteStatus
a -> Invite
s {$sel:status:Invite' :: Maybe InviteStatus
status = Maybe InviteStatus
a} :: Invite)

-- | The status of the invite email.
invite_emailStatus :: Lens.Lens' Invite (Prelude.Maybe EmailStatus)
invite_emailStatus :: (Maybe EmailStatus -> f (Maybe EmailStatus)) -> Invite -> f Invite
invite_emailStatus = (Invite -> Maybe EmailStatus)
-> (Invite -> Maybe EmailStatus -> Invite)
-> Lens Invite Invite (Maybe EmailStatus) (Maybe EmailStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Invite' {Maybe EmailStatus
emailStatus :: Maybe EmailStatus
$sel:emailStatus:Invite' :: Invite -> Maybe EmailStatus
emailStatus} -> Maybe EmailStatus
emailStatus) (\s :: Invite
s@Invite' {} Maybe EmailStatus
a -> Invite
s {$sel:emailStatus:Invite' :: Maybe EmailStatus
emailStatus = Maybe EmailStatus
a} :: Invite)

-- | The invite ID.
invite_inviteId :: Lens.Lens' Invite (Prelude.Maybe Prelude.Text)
invite_inviteId :: (Maybe Text -> f (Maybe Text)) -> Invite -> f Invite
invite_inviteId = (Invite -> Maybe Text)
-> (Invite -> Maybe Text -> Invite)
-> Lens Invite Invite (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Invite' {Maybe Text
inviteId :: Maybe Text
$sel:inviteId:Invite' :: Invite -> Maybe Text
inviteId} -> Maybe Text
inviteId) (\s :: Invite
s@Invite' {} Maybe Text
a -> Invite
s {$sel:inviteId:Invite' :: Maybe Text
inviteId = Maybe Text
a} :: Invite)

-- | The email address to which the invite is sent.
invite_emailAddress :: Lens.Lens' Invite (Prelude.Maybe Prelude.Text)
invite_emailAddress :: (Maybe Text -> f (Maybe Text)) -> Invite -> f Invite
invite_emailAddress = (Invite -> Maybe (Sensitive Text))
-> (Invite -> Maybe (Sensitive Text) -> Invite)
-> Lens
     Invite Invite (Maybe (Sensitive Text)) (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Invite' {Maybe (Sensitive Text)
emailAddress :: Maybe (Sensitive Text)
$sel:emailAddress:Invite' :: Invite -> Maybe (Sensitive Text)
emailAddress} -> Maybe (Sensitive Text)
emailAddress) (\s :: Invite
s@Invite' {} Maybe (Sensitive Text)
a -> Invite
s {$sel:emailAddress:Invite' :: Maybe (Sensitive Text)
emailAddress = Maybe (Sensitive Text)
a} :: Invite) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> Invite -> f Invite)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Invite
-> f Invite
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 Invite where
  parseJSON :: Value -> Parser Invite
parseJSON =
    String -> (Object -> Parser Invite) -> Value -> Parser Invite
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Invite"
      ( \Object
x ->
          Maybe InviteStatus
-> Maybe EmailStatus
-> Maybe Text
-> Maybe (Sensitive Text)
-> Invite
Invite'
            (Maybe InviteStatus
 -> Maybe EmailStatus
 -> Maybe Text
 -> Maybe (Sensitive Text)
 -> Invite)
-> Parser (Maybe InviteStatus)
-> Parser
     (Maybe EmailStatus
      -> Maybe Text -> Maybe (Sensitive Text) -> Invite)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe InviteStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe EmailStatus
   -> Maybe Text -> Maybe (Sensitive Text) -> Invite)
-> Parser (Maybe EmailStatus)
-> Parser (Maybe Text -> Maybe (Sensitive Text) -> Invite)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EmailStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EmailStatus")
            Parser (Maybe Text -> Maybe (Sensitive Text) -> Invite)
-> Parser (Maybe Text) -> Parser (Maybe (Sensitive Text) -> Invite)
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
"InviteId")
            Parser (Maybe (Sensitive Text) -> Invite)
-> Parser (Maybe (Sensitive Text)) -> Parser Invite
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
"EmailAddress")
      )

instance Prelude.Hashable Invite

instance Prelude.NFData Invite