{-# 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-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)
--
-- 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.Lens as Lens
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
(PutInvitationConfiguration -> PutInvitationConfiguration -> Bool)
-> (PutInvitationConfiguration
    -> PutInvitationConfiguration -> Bool)
-> Eq PutInvitationConfiguration
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]
(Int -> ReadS PutInvitationConfiguration)
-> ReadS [PutInvitationConfiguration]
-> ReadPrec PutInvitationConfiguration
-> ReadPrec [PutInvitationConfiguration]
-> Read 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
(Int -> PutInvitationConfiguration -> ShowS)
-> (PutInvitationConfiguration -> String)
-> ([PutInvitationConfiguration] -> ShowS)
-> Show PutInvitationConfiguration
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.
 PutInvitationConfiguration -> Rep PutInvitationConfiguration x)
-> (forall x.
    Rep PutInvitationConfiguration x -> PutInvitationConfiguration)
-> Generic PutInvitationConfiguration
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' :: Maybe Text -> Maybe [Text] -> Text -> PutInvitationConfiguration
PutInvitationConfiguration'
    { $sel:contactEmail:PutInvitationConfiguration' :: Maybe Text
contactEmail =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:privateSkillIds:PutInvitationConfiguration' :: Maybe [Text]
privateSkillIds = Maybe [Text]
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 :: (Maybe Text -> f (Maybe Text))
-> PutInvitationConfiguration -> f PutInvitationConfiguration
putInvitationConfiguration_contactEmail = (PutInvitationConfiguration -> Maybe Text)
-> (PutInvitationConfiguration
    -> Maybe Text -> PutInvitationConfiguration)
-> Lens
     PutInvitationConfiguration
     PutInvitationConfiguration
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe [Text] -> f (Maybe [Text]))
-> PutInvitationConfiguration -> f PutInvitationConfiguration
putInvitationConfiguration_privateSkillIds = (PutInvitationConfiguration -> Maybe [Text])
-> (PutInvitationConfiguration
    -> Maybe [Text] -> PutInvitationConfiguration)
-> Lens
     PutInvitationConfiguration
     PutInvitationConfiguration
     (Maybe [Text])
     (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> PutInvitationConfiguration -> f PutInvitationConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> PutInvitationConfiguration
-> f PutInvitationConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
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 :: (Text -> f Text)
-> PutInvitationConfiguration -> f PutInvitationConfiguration
putInvitationConfiguration_organizationName = (PutInvitationConfiguration -> Text)
-> (PutInvitationConfiguration
    -> Text -> PutInvitationConfiguration)
-> Lens
     PutInvitationConfiguration PutInvitationConfiguration Text Text
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 :: PutInvitationConfiguration -> Request PutInvitationConfiguration
request = Service
-> PutInvitationConfiguration -> Request PutInvitationConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutInvitationConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutInvitationConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse PutInvitationConfiguration))
-> Logger
-> Service
-> Proxy PutInvitationConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutInvitationConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> PutInvitationConfigurationResponse
PutInvitationConfigurationResponse'
            (Int -> PutInvitationConfigurationResponse)
-> Either String Int
-> Either String PutInvitationConfigurationResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable PutInvitationConfiguration

instance Prelude.NFData PutInvitationConfiguration

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

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ContactEmail" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
contactEmail,
            (Text
"PrivateSkillIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
privateSkillIds,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"OrganizationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationName)
          ]
      )

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

instance Core.ToQuery PutInvitationConfiguration where
  toQuery :: PutInvitationConfiguration -> QueryString
toQuery = QueryString -> PutInvitationConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(PutInvitationConfigurationResponse
 -> PutInvitationConfigurationResponse -> Bool)
-> (PutInvitationConfigurationResponse
    -> PutInvitationConfigurationResponse -> Bool)
-> Eq PutInvitationConfigurationResponse
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]
(Int -> ReadS PutInvitationConfigurationResponse)
-> ReadS [PutInvitationConfigurationResponse]
-> ReadPrec PutInvitationConfigurationResponse
-> ReadPrec [PutInvitationConfigurationResponse]
-> Read 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
(Int -> PutInvitationConfigurationResponse -> ShowS)
-> (PutInvitationConfigurationResponse -> String)
-> ([PutInvitationConfigurationResponse] -> ShowS)
-> Show PutInvitationConfigurationResponse
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.
 PutInvitationConfigurationResponse
 -> Rep PutInvitationConfigurationResponse x)
-> (forall x.
    Rep PutInvitationConfigurationResponse x
    -> PutInvitationConfigurationResponse)
-> Generic PutInvitationConfigurationResponse
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' :: Int -> PutInvitationConfigurationResponse
PutInvitationConfigurationResponse'
    { $sel:httpStatus:PutInvitationConfigurationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
putInvitationConfigurationResponse_httpStatus :: Lens.Lens' PutInvitationConfigurationResponse Prelude.Int
putInvitationConfigurationResponse_httpStatus :: (Int -> f Int)
-> PutInvitationConfigurationResponse
-> f PutInvitationConfigurationResponse
putInvitationConfigurationResponse_httpStatus = (PutInvitationConfigurationResponse -> Int)
-> (PutInvitationConfigurationResponse
    -> Int -> PutInvitationConfigurationResponse)
-> Lens
     PutInvitationConfigurationResponse
     PutInvitationConfigurationResponse
     Int
     Int
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