{-# 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.SESV2.Types.IdentityInfo
-- 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.SESV2.Types.IdentityInfo where

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 Amazonka.SESV2.Types.IdentityType
import Amazonka.SESV2.Types.VerificationStatus

-- | Information about an email identity.
--
-- /See:/ 'newIdentityInfo' smart constructor.
data IdentityInfo = IdentityInfo'
  { -- | The address or domain of the identity.
    IdentityInfo -> Maybe Text
identityName :: Prelude.Maybe Prelude.Text,
    -- | The email identity type. Note: the @MANAGED_DOMAIN@ type is not
    -- supported for email identity types.
    IdentityInfo -> Maybe IdentityType
identityType :: Prelude.Maybe IdentityType,
    -- | Indicates whether or not you can send email from the identity.
    --
    -- An /identity/ is an email address or domain that you send email from.
    -- Before you can send email from an identity, you have to demostrate that
    -- you own the identity, and that you authorize Amazon SES to send email
    -- from that identity.
    IdentityInfo -> Maybe Bool
sendingEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The verification status of the identity. The status can be one of the
    -- following:
    --
    -- -   @PENDING@ – The verification process was initiated, but Amazon SES
    --     hasn\'t yet been able to verify the identity.
    --
    -- -   @SUCCESS@ – The verification process completed successfully.
    --
    -- -   @FAILED@ – The verification process failed.
    --
    -- -   @TEMPORARY_FAILURE@ – A temporary issue is preventing Amazon SES
    --     from determining the verification status of the identity.
    --
    -- -   @NOT_STARTED@ – The verification process hasn\'t been initiated for
    --     the identity.
    IdentityInfo -> Maybe VerificationStatus
verificationStatus :: Prelude.Maybe VerificationStatus
  }
  deriving (IdentityInfo -> IdentityInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdentityInfo -> IdentityInfo -> Bool
$c/= :: IdentityInfo -> IdentityInfo -> Bool
== :: IdentityInfo -> IdentityInfo -> Bool
$c== :: IdentityInfo -> IdentityInfo -> Bool
Prelude.Eq, ReadPrec [IdentityInfo]
ReadPrec IdentityInfo
Int -> ReadS IdentityInfo
ReadS [IdentityInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IdentityInfo]
$creadListPrec :: ReadPrec [IdentityInfo]
readPrec :: ReadPrec IdentityInfo
$creadPrec :: ReadPrec IdentityInfo
readList :: ReadS [IdentityInfo]
$creadList :: ReadS [IdentityInfo]
readsPrec :: Int -> ReadS IdentityInfo
$creadsPrec :: Int -> ReadS IdentityInfo
Prelude.Read, Int -> IdentityInfo -> ShowS
[IdentityInfo] -> ShowS
IdentityInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentityInfo] -> ShowS
$cshowList :: [IdentityInfo] -> ShowS
show :: IdentityInfo -> String
$cshow :: IdentityInfo -> String
showsPrec :: Int -> IdentityInfo -> ShowS
$cshowsPrec :: Int -> IdentityInfo -> ShowS
Prelude.Show, forall x. Rep IdentityInfo x -> IdentityInfo
forall x. IdentityInfo -> Rep IdentityInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IdentityInfo x -> IdentityInfo
$cfrom :: forall x. IdentityInfo -> Rep IdentityInfo x
Prelude.Generic)

-- |
-- Create a value of 'IdentityInfo' 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:
--
-- 'identityName', 'identityInfo_identityName' - The address or domain of the identity.
--
-- 'identityType', 'identityInfo_identityType' - The email identity type. Note: the @MANAGED_DOMAIN@ type is not
-- supported for email identity types.
--
-- 'sendingEnabled', 'identityInfo_sendingEnabled' - Indicates whether or not you can send email from the identity.
--
-- An /identity/ is an email address or domain that you send email from.
-- Before you can send email from an identity, you have to demostrate that
-- you own the identity, and that you authorize Amazon SES to send email
-- from that identity.
--
-- 'verificationStatus', 'identityInfo_verificationStatus' - The verification status of the identity. The status can be one of the
-- following:
--
-- -   @PENDING@ – The verification process was initiated, but Amazon SES
--     hasn\'t yet been able to verify the identity.
--
-- -   @SUCCESS@ – The verification process completed successfully.
--
-- -   @FAILED@ – The verification process failed.
--
-- -   @TEMPORARY_FAILURE@ – A temporary issue is preventing Amazon SES
--     from determining the verification status of the identity.
--
-- -   @NOT_STARTED@ – The verification process hasn\'t been initiated for
--     the identity.
newIdentityInfo ::
  IdentityInfo
newIdentityInfo :: IdentityInfo
newIdentityInfo =
  IdentityInfo'
    { $sel:identityName:IdentityInfo' :: Maybe Text
identityName = forall a. Maybe a
Prelude.Nothing,
      $sel:identityType:IdentityInfo' :: Maybe IdentityType
identityType = forall a. Maybe a
Prelude.Nothing,
      $sel:sendingEnabled:IdentityInfo' :: Maybe Bool
sendingEnabled = forall a. Maybe a
Prelude.Nothing,
      $sel:verificationStatus:IdentityInfo' :: Maybe VerificationStatus
verificationStatus = forall a. Maybe a
Prelude.Nothing
    }

-- | The address or domain of the identity.
identityInfo_identityName :: Lens.Lens' IdentityInfo (Prelude.Maybe Prelude.Text)
identityInfo_identityName :: Lens' IdentityInfo (Maybe Text)
identityInfo_identityName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityInfo' {Maybe Text
identityName :: Maybe Text
$sel:identityName:IdentityInfo' :: IdentityInfo -> Maybe Text
identityName} -> Maybe Text
identityName) (\s :: IdentityInfo
s@IdentityInfo' {} Maybe Text
a -> IdentityInfo
s {$sel:identityName:IdentityInfo' :: Maybe Text
identityName = Maybe Text
a} :: IdentityInfo)

-- | The email identity type. Note: the @MANAGED_DOMAIN@ type is not
-- supported for email identity types.
identityInfo_identityType :: Lens.Lens' IdentityInfo (Prelude.Maybe IdentityType)
identityInfo_identityType :: Lens' IdentityInfo (Maybe IdentityType)
identityInfo_identityType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityInfo' {Maybe IdentityType
identityType :: Maybe IdentityType
$sel:identityType:IdentityInfo' :: IdentityInfo -> Maybe IdentityType
identityType} -> Maybe IdentityType
identityType) (\s :: IdentityInfo
s@IdentityInfo' {} Maybe IdentityType
a -> IdentityInfo
s {$sel:identityType:IdentityInfo' :: Maybe IdentityType
identityType = Maybe IdentityType
a} :: IdentityInfo)

-- | Indicates whether or not you can send email from the identity.
--
-- An /identity/ is an email address or domain that you send email from.
-- Before you can send email from an identity, you have to demostrate that
-- you own the identity, and that you authorize Amazon SES to send email
-- from that identity.
identityInfo_sendingEnabled :: Lens.Lens' IdentityInfo (Prelude.Maybe Prelude.Bool)
identityInfo_sendingEnabled :: Lens' IdentityInfo (Maybe Bool)
identityInfo_sendingEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityInfo' {Maybe Bool
sendingEnabled :: Maybe Bool
$sel:sendingEnabled:IdentityInfo' :: IdentityInfo -> Maybe Bool
sendingEnabled} -> Maybe Bool
sendingEnabled) (\s :: IdentityInfo
s@IdentityInfo' {} Maybe Bool
a -> IdentityInfo
s {$sel:sendingEnabled:IdentityInfo' :: Maybe Bool
sendingEnabled = Maybe Bool
a} :: IdentityInfo)

-- | The verification status of the identity. The status can be one of the
-- following:
--
-- -   @PENDING@ – The verification process was initiated, but Amazon SES
--     hasn\'t yet been able to verify the identity.
--
-- -   @SUCCESS@ – The verification process completed successfully.
--
-- -   @FAILED@ – The verification process failed.
--
-- -   @TEMPORARY_FAILURE@ – A temporary issue is preventing Amazon SES
--     from determining the verification status of the identity.
--
-- -   @NOT_STARTED@ – The verification process hasn\'t been initiated for
--     the identity.
identityInfo_verificationStatus :: Lens.Lens' IdentityInfo (Prelude.Maybe VerificationStatus)
identityInfo_verificationStatus :: Lens' IdentityInfo (Maybe VerificationStatus)
identityInfo_verificationStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityInfo' {Maybe VerificationStatus
verificationStatus :: Maybe VerificationStatus
$sel:verificationStatus:IdentityInfo' :: IdentityInfo -> Maybe VerificationStatus
verificationStatus} -> Maybe VerificationStatus
verificationStatus) (\s :: IdentityInfo
s@IdentityInfo' {} Maybe VerificationStatus
a -> IdentityInfo
s {$sel:verificationStatus:IdentityInfo' :: Maybe VerificationStatus
verificationStatus = Maybe VerificationStatus
a} :: IdentityInfo)

instance Data.FromJSON IdentityInfo where
  parseJSON :: Value -> Parser IdentityInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IdentityInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe IdentityType
-> Maybe Bool
-> Maybe VerificationStatus
-> IdentityInfo
IdentityInfo'
            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
"IdentityName")
            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
"IdentityType")
            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
"SendingEnabled")
            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
"VerificationStatus")
      )

instance Prelude.Hashable IdentityInfo where
  hashWithSalt :: Int -> IdentityInfo -> Int
hashWithSalt Int
_salt IdentityInfo' {Maybe Bool
Maybe Text
Maybe IdentityType
Maybe VerificationStatus
verificationStatus :: Maybe VerificationStatus
sendingEnabled :: Maybe Bool
identityType :: Maybe IdentityType
identityName :: Maybe Text
$sel:verificationStatus:IdentityInfo' :: IdentityInfo -> Maybe VerificationStatus
$sel:sendingEnabled:IdentityInfo' :: IdentityInfo -> Maybe Bool
$sel:identityType:IdentityInfo' :: IdentityInfo -> Maybe IdentityType
$sel:identityName:IdentityInfo' :: IdentityInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identityName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IdentityType
identityType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
sendingEnabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VerificationStatus
verificationStatus

instance Prelude.NFData IdentityInfo where
  rnf :: IdentityInfo -> ()
rnf IdentityInfo' {Maybe Bool
Maybe Text
Maybe IdentityType
Maybe VerificationStatus
verificationStatus :: Maybe VerificationStatus
sendingEnabled :: Maybe Bool
identityType :: Maybe IdentityType
identityName :: Maybe Text
$sel:verificationStatus:IdentityInfo' :: IdentityInfo -> Maybe VerificationStatus
$sel:sendingEnabled:IdentityInfo' :: IdentityInfo -> Maybe Bool
$sel:identityType:IdentityInfo' :: IdentityInfo -> Maybe IdentityType
$sel:identityName:IdentityInfo' :: IdentityInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identityName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe IdentityType
identityType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
sendingEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VerificationStatus
verificationStatus