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

import Amazonka.Chime.Types.EmailStatus
import Amazonka.Chime.Types.InviteStatus
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

-- | Invitation object returned after emailing users to invite them to join
-- the Amazon Chime @Team@ account.
--
-- /See:/ 'newInvite' smart constructor.
data Invite = Invite'
  { -- | The email address to which the invite is sent.
    Invite -> Maybe (Sensitive Text)
emailAddress :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | 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 status of the invite.
    Invite -> Maybe InviteStatus
status :: Prelude.Maybe InviteStatus
  }
  deriving (Invite -> Invite -> Bool
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
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. 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:
--
-- 'emailAddress', 'invite_emailAddress' - The email address to which the invite is sent.
--
-- 'emailStatus', 'invite_emailStatus' - The status of the invite email.
--
-- 'inviteId', 'invite_inviteId' - The invite ID.
--
-- 'status', 'invite_status' - The status of the invite.
newInvite ::
  Invite
newInvite :: Invite
newInvite =
  Invite'
    { $sel:emailAddress:Invite' :: Maybe (Sensitive Text)
emailAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:emailStatus:Invite' :: Maybe EmailStatus
emailStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:inviteId:Invite' :: Maybe Text
inviteId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:Invite' :: Maybe InviteStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The email address to which the invite is sent.
invite_emailAddress :: Lens.Lens' Invite (Prelude.Maybe Prelude.Text)
invite_emailAddress :: Lens' Invite (Maybe Text)
invite_emailAddress = 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) 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 status of the invite email.
invite_emailStatus :: Lens.Lens' Invite (Prelude.Maybe EmailStatus)
invite_emailStatus :: Lens' Invite (Maybe EmailStatus)
invite_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 :: Lens' Invite (Maybe Text)
invite_inviteId = 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 status of the invite.
invite_status :: Lens.Lens' Invite (Prelude.Maybe InviteStatus)
invite_status :: Lens' Invite (Maybe InviteStatus)
invite_status = 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)

instance Data.FromJSON Invite where
  parseJSON :: Value -> Parser Invite
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Invite"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe EmailStatus -> Maybe Text -> Maybe InviteStatus -> Invite
Invite'
            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
"EmailAddress")
            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
"EmailStatus")
            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
"InviteId")
            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
"Status")
      )

instance Prelude.Hashable Invite where
  hashWithSalt :: Int -> Invite -> Int
hashWithSalt Int
_salt Invite' {Maybe Text
Maybe (Sensitive Text)
Maybe EmailStatus
Maybe InviteStatus
status :: Maybe InviteStatus
inviteId :: Maybe Text
emailStatus :: Maybe EmailStatus
emailAddress :: Maybe (Sensitive Text)
$sel:status:Invite' :: Invite -> Maybe InviteStatus
$sel:inviteId:Invite' :: Invite -> Maybe Text
$sel:emailStatus:Invite' :: Invite -> Maybe EmailStatus
$sel:emailAddress:Invite' :: Invite -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
emailAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EmailStatus
emailStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inviteId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InviteStatus
status

instance Prelude.NFData Invite where
  rnf :: Invite -> ()
rnf Invite' {Maybe Text
Maybe (Sensitive Text)
Maybe EmailStatus
Maybe InviteStatus
status :: Maybe InviteStatus
inviteId :: Maybe Text
emailStatus :: Maybe EmailStatus
emailAddress :: Maybe (Sensitive Text)
$sel:status:Invite' :: Invite -> Maybe InviteStatus
$sel:inviteId:Invite' :: Invite -> Maybe Text
$sel:emailStatus:Invite' :: Invite -> Maybe EmailStatus
$sel:emailAddress:Invite' :: Invite -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
emailAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EmailStatus
emailStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inviteId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InviteStatus
status