{-# 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.IoTEvents.Types.RecipientDetail
-- 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.IoTEvents.Types.RecipientDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTEvents.Types.SSOIdentity
import qualified Amazonka.Prelude as Prelude

-- | The information that identifies the recipient.
--
-- /See:/ 'newRecipientDetail' smart constructor.
data RecipientDetail = RecipientDetail'
  { -- | The AWS Single Sign-On (AWS SSO) authentication information.
    RecipientDetail -> Maybe SSOIdentity
ssoIdentity :: Prelude.Maybe SSOIdentity
  }
  deriving (RecipientDetail -> RecipientDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecipientDetail -> RecipientDetail -> Bool
$c/= :: RecipientDetail -> RecipientDetail -> Bool
== :: RecipientDetail -> RecipientDetail -> Bool
$c== :: RecipientDetail -> RecipientDetail -> Bool
Prelude.Eq, ReadPrec [RecipientDetail]
ReadPrec RecipientDetail
Int -> ReadS RecipientDetail
ReadS [RecipientDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecipientDetail]
$creadListPrec :: ReadPrec [RecipientDetail]
readPrec :: ReadPrec RecipientDetail
$creadPrec :: ReadPrec RecipientDetail
readList :: ReadS [RecipientDetail]
$creadList :: ReadS [RecipientDetail]
readsPrec :: Int -> ReadS RecipientDetail
$creadsPrec :: Int -> ReadS RecipientDetail
Prelude.Read, Int -> RecipientDetail -> ShowS
[RecipientDetail] -> ShowS
RecipientDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecipientDetail] -> ShowS
$cshowList :: [RecipientDetail] -> ShowS
show :: RecipientDetail -> String
$cshow :: RecipientDetail -> String
showsPrec :: Int -> RecipientDetail -> ShowS
$cshowsPrec :: Int -> RecipientDetail -> ShowS
Prelude.Show, forall x. Rep RecipientDetail x -> RecipientDetail
forall x. RecipientDetail -> Rep RecipientDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecipientDetail x -> RecipientDetail
$cfrom :: forall x. RecipientDetail -> Rep RecipientDetail x
Prelude.Generic)

-- |
-- Create a value of 'RecipientDetail' 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:
--
-- 'ssoIdentity', 'recipientDetail_ssoIdentity' - The AWS Single Sign-On (AWS SSO) authentication information.
newRecipientDetail ::
  RecipientDetail
newRecipientDetail :: RecipientDetail
newRecipientDetail =
  RecipientDetail' {$sel:ssoIdentity:RecipientDetail' :: Maybe SSOIdentity
ssoIdentity = forall a. Maybe a
Prelude.Nothing}

-- | The AWS Single Sign-On (AWS SSO) authentication information.
recipientDetail_ssoIdentity :: Lens.Lens' RecipientDetail (Prelude.Maybe SSOIdentity)
recipientDetail_ssoIdentity :: Lens' RecipientDetail (Maybe SSOIdentity)
recipientDetail_ssoIdentity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecipientDetail' {Maybe SSOIdentity
ssoIdentity :: Maybe SSOIdentity
$sel:ssoIdentity:RecipientDetail' :: RecipientDetail -> Maybe SSOIdentity
ssoIdentity} -> Maybe SSOIdentity
ssoIdentity) (\s :: RecipientDetail
s@RecipientDetail' {} Maybe SSOIdentity
a -> RecipientDetail
s {$sel:ssoIdentity:RecipientDetail' :: Maybe SSOIdentity
ssoIdentity = Maybe SSOIdentity
a} :: RecipientDetail)

instance Data.FromJSON RecipientDetail where
  parseJSON :: Value -> Parser RecipientDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RecipientDetail"
      ( \Object
x ->
          Maybe SSOIdentity -> RecipientDetail
RecipientDetail'
            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
"ssoIdentity")
      )

instance Prelude.Hashable RecipientDetail where
  hashWithSalt :: Int -> RecipientDetail -> Int
hashWithSalt Int
_salt RecipientDetail' {Maybe SSOIdentity
ssoIdentity :: Maybe SSOIdentity
$sel:ssoIdentity:RecipientDetail' :: RecipientDetail -> Maybe SSOIdentity
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SSOIdentity
ssoIdentity

instance Prelude.NFData RecipientDetail where
  rnf :: RecipientDetail -> ()
rnf RecipientDetail' {Maybe SSOIdentity
ssoIdentity :: Maybe SSOIdentity
$sel:ssoIdentity:RecipientDetail' :: RecipientDetail -> Maybe SSOIdentity
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe SSOIdentity
ssoIdentity

instance Data.ToJSON RecipientDetail where
  toJSON :: RecipientDetail -> Value
toJSON RecipientDetail' {Maybe SSOIdentity
ssoIdentity :: Maybe SSOIdentity
$sel:ssoIdentity:RecipientDetail' :: RecipientDetail -> Maybe SSOIdentity
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"ssoIdentity" 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 SSOIdentity
ssoIdentity]
      )