{-# 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.PinpointSmsVoiceV2.Types.AccountAttribute
-- 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.PinpointSmsVoiceV2.Types.AccountAttribute where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.PinpointSmsVoiceV2.Types.AccountAttributeName
import qualified Amazonka.Prelude as Prelude

-- | Displays the attributes associated with a single Amazon Web Services
-- account.
--
-- /See:/ 'newAccountAttribute' smart constructor.
data AccountAttribute = AccountAttribute'
  { -- | The name of the account attribute.
    AccountAttribute -> AccountAttributeName
name :: AccountAttributeName,
    -- | The value associated with the account attribute name.
    AccountAttribute -> Text
value :: Prelude.Text
  }
  deriving (AccountAttribute -> AccountAttribute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountAttribute -> AccountAttribute -> Bool
$c/= :: AccountAttribute -> AccountAttribute -> Bool
== :: AccountAttribute -> AccountAttribute -> Bool
$c== :: AccountAttribute -> AccountAttribute -> Bool
Prelude.Eq, ReadPrec [AccountAttribute]
ReadPrec AccountAttribute
Int -> ReadS AccountAttribute
ReadS [AccountAttribute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountAttribute]
$creadListPrec :: ReadPrec [AccountAttribute]
readPrec :: ReadPrec AccountAttribute
$creadPrec :: ReadPrec AccountAttribute
readList :: ReadS [AccountAttribute]
$creadList :: ReadS [AccountAttribute]
readsPrec :: Int -> ReadS AccountAttribute
$creadsPrec :: Int -> ReadS AccountAttribute
Prelude.Read, Int -> AccountAttribute -> ShowS
[AccountAttribute] -> ShowS
AccountAttribute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountAttribute] -> ShowS
$cshowList :: [AccountAttribute] -> ShowS
show :: AccountAttribute -> String
$cshow :: AccountAttribute -> String
showsPrec :: Int -> AccountAttribute -> ShowS
$cshowsPrec :: Int -> AccountAttribute -> ShowS
Prelude.Show, forall x. Rep AccountAttribute x -> AccountAttribute
forall x. AccountAttribute -> Rep AccountAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountAttribute x -> AccountAttribute
$cfrom :: forall x. AccountAttribute -> Rep AccountAttribute x
Prelude.Generic)

-- |
-- Create a value of 'AccountAttribute' 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:
--
-- 'name', 'accountAttribute_name' - The name of the account attribute.
--
-- 'value', 'accountAttribute_value' - The value associated with the account attribute name.
newAccountAttribute ::
  -- | 'name'
  AccountAttributeName ->
  -- | 'value'
  Prelude.Text ->
  AccountAttribute
newAccountAttribute :: AccountAttributeName -> Text -> AccountAttribute
newAccountAttribute AccountAttributeName
pName_ Text
pValue_ =
  AccountAttribute' {$sel:name:AccountAttribute' :: AccountAttributeName
name = AccountAttributeName
pName_, $sel:value:AccountAttribute' :: Text
value = Text
pValue_}

-- | The name of the account attribute.
accountAttribute_name :: Lens.Lens' AccountAttribute AccountAttributeName
accountAttribute_name :: Lens' AccountAttribute AccountAttributeName
accountAttribute_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAttribute' {AccountAttributeName
name :: AccountAttributeName
$sel:name:AccountAttribute' :: AccountAttribute -> AccountAttributeName
name} -> AccountAttributeName
name) (\s :: AccountAttribute
s@AccountAttribute' {} AccountAttributeName
a -> AccountAttribute
s {$sel:name:AccountAttribute' :: AccountAttributeName
name = AccountAttributeName
a} :: AccountAttribute)

-- | The value associated with the account attribute name.
accountAttribute_value :: Lens.Lens' AccountAttribute Prelude.Text
accountAttribute_value :: Lens' AccountAttribute Text
accountAttribute_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAttribute' {Text
value :: Text
$sel:value:AccountAttribute' :: AccountAttribute -> Text
value} -> Text
value) (\s :: AccountAttribute
s@AccountAttribute' {} Text
a -> AccountAttribute
s {$sel:value:AccountAttribute' :: Text
value = Text
a} :: AccountAttribute)

instance Data.FromJSON AccountAttribute where
  parseJSON :: Value -> Parser AccountAttribute
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AccountAttribute"
      ( \Object
x ->
          AccountAttributeName -> Text -> AccountAttribute
AccountAttribute'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Value")
      )

instance Prelude.Hashable AccountAttribute where
  hashWithSalt :: Int -> AccountAttribute -> Int
hashWithSalt Int
_salt AccountAttribute' {Text
AccountAttributeName
value :: Text
name :: AccountAttributeName
$sel:value:AccountAttribute' :: AccountAttribute -> Text
$sel:name:AccountAttribute' :: AccountAttribute -> AccountAttributeName
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AccountAttributeName
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value

instance Prelude.NFData AccountAttribute where
  rnf :: AccountAttribute -> ()
rnf AccountAttribute' {Text
AccountAttributeName
value :: Text
name :: AccountAttributeName
$sel:value:AccountAttribute' :: AccountAttribute -> Text
$sel:name:AccountAttribute' :: AccountAttribute -> AccountAttributeName
..} =
    forall a. NFData a => a -> ()
Prelude.rnf AccountAttributeName
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value