{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AlexaBusiness.PutInvitationConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Configures the email template for the user enrollment invitation with
-- the specified attributes.
module Amazonka.AlexaBusiness.PutInvitationConfiguration
  ( -- * Creating a Request
    PutInvitationConfiguration (..),
    newPutInvitationConfiguration,

    -- * Request Lenses
    putInvitationConfiguration_contactEmail,
    putInvitationConfiguration_privateSkillIds,
    putInvitationConfiguration_organizationName,

    -- * Destructuring the Response
    PutInvitationConfigurationResponse (..),
    newPutInvitationConfigurationResponse,

    -- * Response Lenses
    putInvitationConfigurationResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newPutInvitationConfiguration' smart constructor.
data PutInvitationConfiguration = PutInvitationConfiguration'
  { -- | The email ID of the organization or individual contact that the enrolled
    -- user can use.
    PutInvitationConfiguration -> Maybe Text
contactEmail :: Prelude.Maybe Prelude.Text,
    -- | The list of private skill IDs that you want to recommend to the user to
    -- enable in the invitation.
    PutInvitationConfiguration -> Maybe [Text]
privateSkillIds :: Prelude.Maybe [Prelude.Text],
    -- | The name of the organization sending the enrollment invite to a user.
    PutInvitationConfiguration -> Text
organizationName :: Prelude.Text
  }
  deriving (PutInvitationConfiguration -> PutInvitationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutInvitationConfiguration -> PutInvitationConfiguration -> Bool
$c/= :: PutInvitationConfiguration -> PutInvitationConfiguration -> Bool
== :: PutInvitationConfiguration -> PutInvitationConfiguration -> Bool
$c== :: PutInvitationConfiguration -> PutInvitationConfiguration -> Bool
Prelude.Eq, ReadPrec [PutInvitationConfiguration]
ReadPrec PutInvitationConfiguration
Int -> ReadS PutInvitationConfiguration
ReadS [PutInvitationConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutInvitationConfiguration]
$creadListPrec :: ReadPrec [PutInvitationConfiguration]
readPrec :: ReadPrec PutInvitationConfiguration
$creadPrec :: ReadPrec PutInvitationConfiguration
readList :: ReadS [PutInvitationConfiguration]
$creadList :: ReadS [PutInvitationConfiguration]
readsPrec :: Int -> ReadS PutInvitationConfiguration
$creadsPrec :: Int -> ReadS PutInvitationConfiguration
Prelude.Read, Int -> PutInvitationConfiguration -> ShowS
[PutInvitationConfiguration] -> ShowS
PutInvitationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutInvitationConfiguration] -> ShowS
$cshowList :: [PutInvitationConfiguration] -> ShowS
show :: PutInvitationConfiguration -> String
$cshow :: PutInvitationConfiguration -> String
showsPrec :: Int -> PutInvitationConfiguration -> ShowS
$cshowsPrec :: Int -> PutInvitationConfiguration -> ShowS
Prelude.Show, forall x.
Rep PutInvitationConfiguration x -> PutInvitationConfiguration
forall x.
PutInvitationConfiguration -> Rep PutInvitationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutInvitationConfiguration x -> PutInvitationConfiguration
$cfrom :: forall x.
PutInvitationConfiguration -> Rep PutInvitationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'PutInvitationConfiguration' 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:
--
-- 'contactEmail', 'putInvitationConfiguration_contactEmail' - The email ID of the organization or individual contact that the enrolled
-- user can use.
--
-- 'privateSkillIds', 'putInvitationConfiguration_privateSkillIds' - The list of private skill IDs that you want to recommend to the user to
-- enable in the invitation.
--
-- 'organizationName', 'putInvitationConfiguration_organizationName' - The name of the organization sending the enrollment invite to a user.
newPutInvitationConfiguration ::
  -- | 'organizationName'
  Prelude.Text ->
  PutInvitationConfiguration
newPutInvitationConfiguration :: Text -> PutInvitationConfiguration
newPutInvitationConfiguration Text
pOrganizationName_ =
  PutInvitationConfiguration'
    { $sel:contactEmail:PutInvitationConfiguration' :: Maybe Text
contactEmail =
        forall a. Maybe a
Prelude.Nothing,
      $sel:privateSkillIds:PutInvitationConfiguration' :: Maybe [Text]
privateSkillIds = forall a. Maybe a
Prelude.Nothing,
      $sel:organizationName:PutInvitationConfiguration' :: Text
organizationName = Text
pOrganizationName_
    }

-- | The email ID of the organization or individual contact that the enrolled
-- user can use.
putInvitationConfiguration_contactEmail :: Lens.Lens' PutInvitationConfiguration (Prelude.Maybe Prelude.Text)
putInvitationConfiguration_contactEmail :: Lens' PutInvitationConfiguration (Maybe Text)
putInvitationConfiguration_contactEmail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInvitationConfiguration' {Maybe Text
contactEmail :: Maybe Text
$sel:contactEmail:PutInvitationConfiguration' :: PutInvitationConfiguration -> Maybe Text
contactEmail} -> Maybe Text
contactEmail) (\s :: PutInvitationConfiguration
s@PutInvitationConfiguration' {} Maybe Text
a -> PutInvitationConfiguration
s {$sel:contactEmail:PutInvitationConfiguration' :: Maybe Text
contactEmail = Maybe Text
a} :: PutInvitationConfiguration)

-- | The list of private skill IDs that you want to recommend to the user to
-- enable in the invitation.
putInvitationConfiguration_privateSkillIds :: Lens.Lens' PutInvitationConfiguration (Prelude.Maybe [Prelude.Text])
putInvitationConfiguration_privateSkillIds :: Lens' PutInvitationConfiguration (Maybe [Text])
putInvitationConfiguration_privateSkillIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInvitationConfiguration' {Maybe [Text]
privateSkillIds :: Maybe [Text]
$sel:privateSkillIds:PutInvitationConfiguration' :: PutInvitationConfiguration -> Maybe [Text]
privateSkillIds} -> Maybe [Text]
privateSkillIds) (\s :: PutInvitationConfiguration
s@PutInvitationConfiguration' {} Maybe [Text]
a -> PutInvitationConfiguration
s {$sel:privateSkillIds:PutInvitationConfiguration' :: Maybe [Text]
privateSkillIds = Maybe [Text]
a} :: PutInvitationConfiguration) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the organization sending the enrollment invite to a user.
putInvitationConfiguration_organizationName :: Lens.Lens' PutInvitationConfiguration Prelude.Text
putInvitationConfiguration_organizationName :: Lens' PutInvitationConfiguration Text
putInvitationConfiguration_organizationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInvitationConfiguration' {Text
organizationName :: Text
$sel:organizationName:PutInvitationConfiguration' :: PutInvitationConfiguration -> Text
organizationName} -> Text
organizationName) (\s :: PutInvitationConfiguration
s@PutInvitationConfiguration' {} Text
a -> PutInvitationConfiguration
s {$sel:organizationName:PutInvitationConfiguration' :: Text
organizationName = Text
a} :: PutInvitationConfiguration)

instance Core.AWSRequest PutInvitationConfiguration where
  type
    AWSResponse PutInvitationConfiguration =
      PutInvitationConfigurationResponse
  request :: (Service -> Service)
-> PutInvitationConfiguration -> Request PutInvitationConfiguration
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutInvitationConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutInvitationConfiguration)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> PutInvitationConfigurationResponse
PutInvitationConfigurationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable PutInvitationConfiguration where
  hashWithSalt :: Int -> PutInvitationConfiguration -> Int
hashWithSalt Int
_salt PutInvitationConfiguration' {Maybe [Text]
Maybe Text
Text
organizationName :: Text
privateSkillIds :: Maybe [Text]
contactEmail :: Maybe Text
$sel:organizationName:PutInvitationConfiguration' :: PutInvitationConfiguration -> Text
$sel:privateSkillIds:PutInvitationConfiguration' :: PutInvitationConfiguration -> Maybe [Text]
$sel:contactEmail:PutInvitationConfiguration' :: PutInvitationConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contactEmail
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
privateSkillIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
organizationName

instance Prelude.NFData PutInvitationConfiguration where
  rnf :: PutInvitationConfiguration -> ()
rnf PutInvitationConfiguration' {Maybe [Text]
Maybe Text
Text
organizationName :: Text
privateSkillIds :: Maybe [Text]
contactEmail :: Maybe Text
$sel:organizationName:PutInvitationConfiguration' :: PutInvitationConfiguration -> Text
$sel:privateSkillIds:PutInvitationConfiguration' :: PutInvitationConfiguration -> Maybe [Text]
$sel:contactEmail:PutInvitationConfiguration' :: PutInvitationConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contactEmail
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
privateSkillIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
organizationName

instance Data.ToHeaders PutInvitationConfiguration where
  toHeaders :: PutInvitationConfiguration -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AlexaForBusiness.PutInvitationConfiguration" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON PutInvitationConfiguration where
  toJSON :: PutInvitationConfiguration -> Value
toJSON PutInvitationConfiguration' {Maybe [Text]
Maybe Text
Text
organizationName :: Text
privateSkillIds :: Maybe [Text]
contactEmail :: Maybe Text
$sel:organizationName:PutInvitationConfiguration' :: PutInvitationConfiguration -> Text
$sel:privateSkillIds:PutInvitationConfiguration' :: PutInvitationConfiguration -> Maybe [Text]
$sel:contactEmail:PutInvitationConfiguration' :: PutInvitationConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ContactEmail" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
contactEmail,
            (Key
"PrivateSkillIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
privateSkillIds,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"OrganizationName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
organizationName)
          ]
      )

instance Data.ToPath PutInvitationConfiguration where
  toPath :: PutInvitationConfiguration -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery PutInvitationConfiguration where
  toQuery :: PutInvitationConfiguration -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newPutInvitationConfigurationResponse' smart constructor.
data PutInvitationConfigurationResponse = PutInvitationConfigurationResponse'
  { -- | The response's http status code.
    PutInvitationConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutInvitationConfigurationResponse
-> PutInvitationConfigurationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutInvitationConfigurationResponse
-> PutInvitationConfigurationResponse -> Bool
$c/= :: PutInvitationConfigurationResponse
-> PutInvitationConfigurationResponse -> Bool
== :: PutInvitationConfigurationResponse
-> PutInvitationConfigurationResponse -> Bool
$c== :: PutInvitationConfigurationResponse
-> PutInvitationConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [PutInvitationConfigurationResponse]
ReadPrec PutInvitationConfigurationResponse
Int -> ReadS PutInvitationConfigurationResponse
ReadS [PutInvitationConfigurationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutInvitationConfigurationResponse]
$creadListPrec :: ReadPrec [PutInvitationConfigurationResponse]
readPrec :: ReadPrec PutInvitationConfigurationResponse
$creadPrec :: ReadPrec PutInvitationConfigurationResponse
readList :: ReadS [PutInvitationConfigurationResponse]
$creadList :: ReadS [PutInvitationConfigurationResponse]
readsPrec :: Int -> ReadS PutInvitationConfigurationResponse
$creadsPrec :: Int -> ReadS PutInvitationConfigurationResponse
Prelude.Read, Int -> PutInvitationConfigurationResponse -> ShowS
[PutInvitationConfigurationResponse] -> ShowS
PutInvitationConfigurationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutInvitationConfigurationResponse] -> ShowS
$cshowList :: [PutInvitationConfigurationResponse] -> ShowS
show :: PutInvitationConfigurationResponse -> String
$cshow :: PutInvitationConfigurationResponse -> String
showsPrec :: Int -> PutInvitationConfigurationResponse -> ShowS
$cshowsPrec :: Int -> PutInvitationConfigurationResponse -> ShowS
Prelude.Show, forall x.
Rep PutInvitationConfigurationResponse x
-> PutInvitationConfigurationResponse
forall x.
PutInvitationConfigurationResponse
-> Rep PutInvitationConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutInvitationConfigurationResponse x
-> PutInvitationConfigurationResponse
$cfrom :: forall x.
PutInvitationConfigurationResponse
-> Rep PutInvitationConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutInvitationConfigurationResponse' 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:
--
-- 'httpStatus', 'putInvitationConfigurationResponse_httpStatus' - The response's http status code.
newPutInvitationConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutInvitationConfigurationResponse
newPutInvitationConfigurationResponse :: Int -> PutInvitationConfigurationResponse
newPutInvitationConfigurationResponse Int
pHttpStatus_ =
  PutInvitationConfigurationResponse'
    { $sel:httpStatus:PutInvitationConfigurationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
putInvitationConfigurationResponse_httpStatus :: Lens.Lens' PutInvitationConfigurationResponse Prelude.Int
putInvitationConfigurationResponse_httpStatus :: Lens' PutInvitationConfigurationResponse Int
putInvitationConfigurationResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInvitationConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutInvitationConfigurationResponse' :: PutInvitationConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutInvitationConfigurationResponse
s@PutInvitationConfigurationResponse' {} Int
a -> PutInvitationConfigurationResponse
s {$sel:httpStatus:PutInvitationConfigurationResponse' :: Int
httpStatus = Int
a} :: PutInvitationConfigurationResponse)

instance
  Prelude.NFData
    PutInvitationConfigurationResponse
  where
  rnf :: PutInvitationConfigurationResponse -> ()
rnf PutInvitationConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutInvitationConfigurationResponse' :: PutInvitationConfigurationResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus