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

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

-- | Contains information about the account.
--
-- /See:/ 'newAccountDetail' smart constructor.
data AccountDetail = AccountDetail'
  { -- | The member account ID.
    AccountDetail -> Text
accountId :: Prelude.Text,
    -- | The email address of the member account.
    AccountDetail -> Text
email :: 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:
--
-- 'accountId', 'accountDetail_accountId' - The member account ID.
--
-- 'email', 'accountDetail_email' - The email address of the member account.
newAccountDetail ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'email'
  Prelude.Text ->
  AccountDetail
newAccountDetail :: Text -> Text -> AccountDetail
newAccountDetail Text
pAccountId_ Text
pEmail_ =
  AccountDetail' :: Text -> Text -> AccountDetail
AccountDetail'
    { $sel:accountId:AccountDetail' :: Text
accountId = Text
pAccountId_,
      $sel:email:AccountDetail' :: Text
email = Text
pEmail_
    }

-- | The member account ID.
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)

-- | The email address of the member 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)

instance Prelude.Hashable AccountDetail

instance Prelude.NFData AccountDetail

instance Core.ToJSON AccountDetail where
  toJSON :: AccountDetail -> Value
toJSON AccountDetail' {Text
email :: Text
accountId :: Text
$sel:email:AccountDetail' :: AccountDetail -> Text
$sel:accountId: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
"accountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
accountId),
            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)
          ]
      )