{-# 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.Account.Types.AlternateContact
-- 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)
module Amazonka.Account.Types.AlternateContact where

import Amazonka.Account.Types.AlternateContactType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A structure that contains the details of an alternate contact associated
-- with an Amazon Web Services account
--
-- /See:/ 'newAlternateContact' smart constructor.
data AlternateContact = AlternateContact'
  { -- | The type of alternate contact.
    AlternateContact -> Maybe AlternateContactType
alternateContactType :: Prelude.Maybe AlternateContactType,
    -- | The phone number associated with this alternate contact.
    AlternateContact -> Maybe (Sensitive Text)
phoneNumber :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The name associated with this alternate contact.
    AlternateContact -> Maybe (Sensitive Text)
name :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The email address associated with this alternate contact.
    AlternateContact -> Maybe (Sensitive Text)
emailAddress :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The title associated with this alternate contact.
    AlternateContact -> Maybe (Sensitive Text)
title :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (AlternateContact -> AlternateContact -> Bool
(AlternateContact -> AlternateContact -> Bool)
-> (AlternateContact -> AlternateContact -> Bool)
-> Eq AlternateContact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlternateContact -> AlternateContact -> Bool
$c/= :: AlternateContact -> AlternateContact -> Bool
== :: AlternateContact -> AlternateContact -> Bool
$c== :: AlternateContact -> AlternateContact -> Bool
Prelude.Eq, Int -> AlternateContact -> ShowS
[AlternateContact] -> ShowS
AlternateContact -> String
(Int -> AlternateContact -> ShowS)
-> (AlternateContact -> String)
-> ([AlternateContact] -> ShowS)
-> Show AlternateContact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlternateContact] -> ShowS
$cshowList :: [AlternateContact] -> ShowS
show :: AlternateContact -> String
$cshow :: AlternateContact -> String
showsPrec :: Int -> AlternateContact -> ShowS
$cshowsPrec :: Int -> AlternateContact -> ShowS
Prelude.Show, (forall x. AlternateContact -> Rep AlternateContact x)
-> (forall x. Rep AlternateContact x -> AlternateContact)
-> Generic AlternateContact
forall x. Rep AlternateContact x -> AlternateContact
forall x. AlternateContact -> Rep AlternateContact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AlternateContact x -> AlternateContact
$cfrom :: forall x. AlternateContact -> Rep AlternateContact x
Prelude.Generic)

-- |
-- Create a value of 'AlternateContact' 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:
--
-- 'alternateContactType', 'alternateContact_alternateContactType' - The type of alternate contact.
--
-- 'phoneNumber', 'alternateContact_phoneNumber' - The phone number associated with this alternate contact.
--
-- 'name', 'alternateContact_name' - The name associated with this alternate contact.
--
-- 'emailAddress', 'alternateContact_emailAddress' - The email address associated with this alternate contact.
--
-- 'title', 'alternateContact_title' - The title associated with this alternate contact.
newAlternateContact ::
  AlternateContact
newAlternateContact :: AlternateContact
newAlternateContact =
  AlternateContact' :: Maybe AlternateContactType
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> AlternateContact
AlternateContact'
    { $sel:alternateContactType:AlternateContact' :: Maybe AlternateContactType
alternateContactType =
        Maybe AlternateContactType
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumber:AlternateContact' :: Maybe (Sensitive Text)
phoneNumber = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:AlternateContact' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:emailAddress:AlternateContact' :: Maybe (Sensitive Text)
emailAddress = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:title:AlternateContact' :: Maybe (Sensitive Text)
title = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of alternate contact.
alternateContact_alternateContactType :: Lens.Lens' AlternateContact (Prelude.Maybe AlternateContactType)
alternateContact_alternateContactType :: (Maybe AlternateContactType -> f (Maybe AlternateContactType))
-> AlternateContact -> f AlternateContact
alternateContact_alternateContactType = (AlternateContact -> Maybe AlternateContactType)
-> (AlternateContact
    -> Maybe AlternateContactType -> AlternateContact)
-> Lens
     AlternateContact
     AlternateContact
     (Maybe AlternateContactType)
     (Maybe AlternateContactType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlternateContact' {Maybe AlternateContactType
alternateContactType :: Maybe AlternateContactType
$sel:alternateContactType:AlternateContact' :: AlternateContact -> Maybe AlternateContactType
alternateContactType} -> Maybe AlternateContactType
alternateContactType) (\s :: AlternateContact
s@AlternateContact' {} Maybe AlternateContactType
a -> AlternateContact
s {$sel:alternateContactType:AlternateContact' :: Maybe AlternateContactType
alternateContactType = Maybe AlternateContactType
a} :: AlternateContact)

-- | The phone number associated with this alternate contact.
alternateContact_phoneNumber :: Lens.Lens' AlternateContact (Prelude.Maybe Prelude.Text)
alternateContact_phoneNumber :: (Maybe Text -> f (Maybe Text))
-> AlternateContact -> f AlternateContact
alternateContact_phoneNumber = (AlternateContact -> Maybe (Sensitive Text))
-> (AlternateContact -> Maybe (Sensitive Text) -> AlternateContact)
-> Lens
     AlternateContact
     AlternateContact
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlternateContact' {Maybe (Sensitive Text)
phoneNumber :: Maybe (Sensitive Text)
$sel:phoneNumber:AlternateContact' :: AlternateContact -> Maybe (Sensitive Text)
phoneNumber} -> Maybe (Sensitive Text)
phoneNumber) (\s :: AlternateContact
s@AlternateContact' {} Maybe (Sensitive Text)
a -> AlternateContact
s {$sel:phoneNumber:AlternateContact' :: Maybe (Sensitive Text)
phoneNumber = Maybe (Sensitive Text)
a} :: AlternateContact) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> AlternateContact -> f AlternateContact)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AlternateContact
-> f AlternateContact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The name associated with this alternate contact.
alternateContact_name :: Lens.Lens' AlternateContact (Prelude.Maybe Prelude.Text)
alternateContact_name :: (Maybe Text -> f (Maybe Text))
-> AlternateContact -> f AlternateContact
alternateContact_name = (AlternateContact -> Maybe (Sensitive Text))
-> (AlternateContact -> Maybe (Sensitive Text) -> AlternateContact)
-> Lens
     AlternateContact
     AlternateContact
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlternateContact' {Maybe (Sensitive Text)
name :: Maybe (Sensitive Text)
$sel:name:AlternateContact' :: AlternateContact -> Maybe (Sensitive Text)
name} -> Maybe (Sensitive Text)
name) (\s :: AlternateContact
s@AlternateContact' {} Maybe (Sensitive Text)
a -> AlternateContact
s {$sel:name:AlternateContact' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
a} :: AlternateContact) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> AlternateContact -> f AlternateContact)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AlternateContact
-> f AlternateContact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The email address associated with this alternate contact.
alternateContact_emailAddress :: Lens.Lens' AlternateContact (Prelude.Maybe Prelude.Text)
alternateContact_emailAddress :: (Maybe Text -> f (Maybe Text))
-> AlternateContact -> f AlternateContact
alternateContact_emailAddress = (AlternateContact -> Maybe (Sensitive Text))
-> (AlternateContact -> Maybe (Sensitive Text) -> AlternateContact)
-> Lens
     AlternateContact
     AlternateContact
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlternateContact' {Maybe (Sensitive Text)
emailAddress :: Maybe (Sensitive Text)
$sel:emailAddress:AlternateContact' :: AlternateContact -> Maybe (Sensitive Text)
emailAddress} -> Maybe (Sensitive Text)
emailAddress) (\s :: AlternateContact
s@AlternateContact' {} Maybe (Sensitive Text)
a -> AlternateContact
s {$sel:emailAddress:AlternateContact' :: Maybe (Sensitive Text)
emailAddress = Maybe (Sensitive Text)
a} :: AlternateContact) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> AlternateContact -> f AlternateContact)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AlternateContact
-> f AlternateContact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The title associated with this alternate contact.
alternateContact_title :: Lens.Lens' AlternateContact (Prelude.Maybe Prelude.Text)
alternateContact_title :: (Maybe Text -> f (Maybe Text))
-> AlternateContact -> f AlternateContact
alternateContact_title = (AlternateContact -> Maybe (Sensitive Text))
-> (AlternateContact -> Maybe (Sensitive Text) -> AlternateContact)
-> Lens
     AlternateContact
     AlternateContact
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlternateContact' {Maybe (Sensitive Text)
title :: Maybe (Sensitive Text)
$sel:title:AlternateContact' :: AlternateContact -> Maybe (Sensitive Text)
title} -> Maybe (Sensitive Text)
title) (\s :: AlternateContact
s@AlternateContact' {} Maybe (Sensitive Text)
a -> AlternateContact
s {$sel:title:AlternateContact' :: Maybe (Sensitive Text)
title = Maybe (Sensitive Text)
a} :: AlternateContact) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> AlternateContact -> f AlternateContact)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AlternateContact
-> f AlternateContact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.FromJSON AlternateContact where
  parseJSON :: Value -> Parser AlternateContact
parseJSON =
    String
-> (Object -> Parser AlternateContact)
-> Value
-> Parser AlternateContact
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AlternateContact"
      ( \Object
x ->
          Maybe AlternateContactType
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> AlternateContact
AlternateContact'
            (Maybe AlternateContactType
 -> Maybe (Sensitive Text)
 -> Maybe (Sensitive Text)
 -> Maybe (Sensitive Text)
 -> Maybe (Sensitive Text)
 -> AlternateContact)
-> Parser (Maybe AlternateContactType)
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe (Sensitive Text)
      -> Maybe (Sensitive Text)
      -> Maybe (Sensitive Text)
      -> AlternateContact)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AlternateContactType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AlternateContactType")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe (Sensitive Text)
   -> Maybe (Sensitive Text)
   -> Maybe (Sensitive Text)
   -> AlternateContact)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe (Sensitive Text)
      -> Maybe (Sensitive Text)
      -> AlternateContact)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PhoneNumber")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe (Sensitive Text)
   -> Maybe (Sensitive Text)
   -> AlternateContact)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe (Sensitive Text) -> AlternateContact)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe (Sensitive Text) -> AlternateContact)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe (Sensitive Text) -> AlternateContact)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EmailAddress")
            Parser (Maybe (Sensitive Text) -> AlternateContact)
-> Parser (Maybe (Sensitive Text)) -> Parser AlternateContact
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Title")
      )

instance Prelude.Hashable AlternateContact

instance Prelude.NFData AlternateContact