{-# 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.MacieV2.Types.AccountDetail
-- 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.MacieV2.Types.AccountDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the details of an account to associate with an Amazon Macie
-- administrator account.
--
-- /See:/ 'newAccountDetail' smart constructor.
data AccountDetail = AccountDetail'
  { -- | The email address for the account.
    AccountDetail -> Text
email :: Prelude.Text,
    -- | The Amazon Web Services account ID for the account.
    AccountDetail -> Text
accountId :: Prelude.Text
  }
  deriving (AccountDetail -> AccountDetail -> Bool
(AccountDetail -> AccountDetail -> Bool)
-> (AccountDetail -> AccountDetail -> Bool) -> Eq AccountDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountDetail -> AccountDetail -> Bool
$c/= :: AccountDetail -> AccountDetail -> Bool
== :: AccountDetail -> AccountDetail -> Bool
$c== :: AccountDetail -> AccountDetail -> Bool
Prelude.Eq, ReadPrec [AccountDetail]
ReadPrec AccountDetail
Int -> ReadS AccountDetail
ReadS [AccountDetail]
(Int -> ReadS AccountDetail)
-> ReadS [AccountDetail]
-> ReadPrec AccountDetail
-> ReadPrec [AccountDetail]
-> Read AccountDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountDetail]
$creadListPrec :: ReadPrec [AccountDetail]
readPrec :: ReadPrec AccountDetail
$creadPrec :: ReadPrec AccountDetail
readList :: ReadS [AccountDetail]
$creadList :: ReadS [AccountDetail]
readsPrec :: Int -> ReadS AccountDetail
$creadsPrec :: Int -> ReadS AccountDetail
Prelude.Read, Int -> AccountDetail -> ShowS
[AccountDetail] -> ShowS
AccountDetail -> String
(Int -> AccountDetail -> ShowS)
-> (AccountDetail -> String)
-> ([AccountDetail] -> ShowS)
-> Show AccountDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountDetail] -> ShowS
$cshowList :: [AccountDetail] -> ShowS
show :: AccountDetail -> String
$cshow :: AccountDetail -> String
showsPrec :: Int -> AccountDetail -> ShowS
$cshowsPrec :: Int -> AccountDetail -> ShowS
Prelude.Show, (forall x. AccountDetail -> Rep AccountDetail x)
-> (forall x. Rep AccountDetail x -> AccountDetail)
-> Generic AccountDetail
forall x. Rep AccountDetail x -> AccountDetail
forall x. AccountDetail -> Rep AccountDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountDetail x -> AccountDetail
$cfrom :: forall x. AccountDetail -> Rep AccountDetail x
Prelude.Generic)

-- |
-- Create a value of 'AccountDetail' 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:
--
-- 'email', 'accountDetail_email' - The email address for the account.
--
-- 'accountId', 'accountDetail_accountId' - The Amazon Web Services account ID for the account.
newAccountDetail ::
  -- | 'email'
  Prelude.Text ->
  -- | 'accountId'
  Prelude.Text ->
  AccountDetail
newAccountDetail :: Text -> Text -> AccountDetail
newAccountDetail Text
pEmail_ Text
pAccountId_ =
  AccountDetail' :: Text -> Text -> AccountDetail
AccountDetail'
    { $sel:email:AccountDetail' :: Text
email = Text
pEmail_,
      $sel:accountId:AccountDetail' :: Text
accountId = Text
pAccountId_
    }

-- | The email address for the account.
accountDetail_email :: Lens.Lens' AccountDetail Prelude.Text
accountDetail_email :: (Text -> f Text) -> AccountDetail -> f AccountDetail
accountDetail_email = (AccountDetail -> Text)
-> (AccountDetail -> Text -> AccountDetail)
-> Lens AccountDetail AccountDetail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountDetail' {Text
email :: Text
$sel:email:AccountDetail' :: AccountDetail -> Text
email} -> Text
email) (\s :: AccountDetail
s@AccountDetail' {} Text
a -> AccountDetail
s {$sel:email:AccountDetail' :: Text
email = Text
a} :: AccountDetail)

-- | The Amazon Web Services account ID for the account.
accountDetail_accountId :: Lens.Lens' AccountDetail Prelude.Text
accountDetail_accountId :: (Text -> f Text) -> AccountDetail -> f AccountDetail
accountDetail_accountId = (AccountDetail -> Text)
-> (AccountDetail -> Text -> AccountDetail)
-> Lens AccountDetail AccountDetail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountDetail' {Text
accountId :: Text
$sel:accountId:AccountDetail' :: AccountDetail -> Text
accountId} -> Text
accountId) (\s :: AccountDetail
s@AccountDetail' {} Text
a -> AccountDetail
s {$sel:accountId:AccountDetail' :: Text
accountId = Text
a} :: AccountDetail)

instance Prelude.Hashable AccountDetail

instance Prelude.NFData AccountDetail

instance Core.ToJSON AccountDetail where
  toJSON :: AccountDetail -> Value
toJSON AccountDetail' {Text
accountId :: Text
email :: Text
$sel:accountId:AccountDetail' :: AccountDetail -> Text
$sel:email:AccountDetail' :: AccountDetail -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"email" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
email),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"accountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
accountId)
          ]
      )