{-# 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.SES.Types.ExtensionField
-- 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.SES.Types.ExtensionField 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

-- | Additional X-headers to include in the Delivery Status Notification
-- (DSN) when an email that Amazon SES receives on your behalf bounces.
--
-- For information about receiving email through Amazon SES, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email.html Amazon SES Developer Guide>.
--
-- /See:/ 'newExtensionField' smart constructor.
data ExtensionField = ExtensionField'
  { -- | The name of the header to add. Must be between 1 and 50 characters,
    -- inclusive, and consist of alphanumeric (a-z, A-Z, 0-9) characters and
    -- dashes only.
    ExtensionField -> Text
name :: Prelude.Text,
    -- | The value of the header to add. Must be less than 2048 characters, and
    -- must not contain newline characters (\"\\r\" or \"\\n\").
    ExtensionField -> Text
value :: Prelude.Text
  }
  deriving (ExtensionField -> ExtensionField -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExtensionField -> ExtensionField -> Bool
$c/= :: ExtensionField -> ExtensionField -> Bool
== :: ExtensionField -> ExtensionField -> Bool
$c== :: ExtensionField -> ExtensionField -> Bool
Prelude.Eq, ReadPrec [ExtensionField]
ReadPrec ExtensionField
Int -> ReadS ExtensionField
ReadS [ExtensionField]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExtensionField]
$creadListPrec :: ReadPrec [ExtensionField]
readPrec :: ReadPrec ExtensionField
$creadPrec :: ReadPrec ExtensionField
readList :: ReadS [ExtensionField]
$creadList :: ReadS [ExtensionField]
readsPrec :: Int -> ReadS ExtensionField
$creadsPrec :: Int -> ReadS ExtensionField
Prelude.Read, Int -> ExtensionField -> ShowS
[ExtensionField] -> ShowS
ExtensionField -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExtensionField] -> ShowS
$cshowList :: [ExtensionField] -> ShowS
show :: ExtensionField -> String
$cshow :: ExtensionField -> String
showsPrec :: Int -> ExtensionField -> ShowS
$cshowsPrec :: Int -> ExtensionField -> ShowS
Prelude.Show, forall x. Rep ExtensionField x -> ExtensionField
forall x. ExtensionField -> Rep ExtensionField x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExtensionField x -> ExtensionField
$cfrom :: forall x. ExtensionField -> Rep ExtensionField x
Prelude.Generic)

-- |
-- Create a value of 'ExtensionField' 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', 'extensionField_name' - The name of the header to add. Must be between 1 and 50 characters,
-- inclusive, and consist of alphanumeric (a-z, A-Z, 0-9) characters and
-- dashes only.
--
-- 'value', 'extensionField_value' - The value of the header to add. Must be less than 2048 characters, and
-- must not contain newline characters (\"\\r\" or \"\\n\").
newExtensionField ::
  -- | 'name'
  Prelude.Text ->
  -- | 'value'
  Prelude.Text ->
  ExtensionField
newExtensionField :: Text -> Text -> ExtensionField
newExtensionField Text
pName_ Text
pValue_ =
  ExtensionField' {$sel:name:ExtensionField' :: Text
name = Text
pName_, $sel:value:ExtensionField' :: Text
value = Text
pValue_}

-- | The name of the header to add. Must be between 1 and 50 characters,
-- inclusive, and consist of alphanumeric (a-z, A-Z, 0-9) characters and
-- dashes only.
extensionField_name :: Lens.Lens' ExtensionField Prelude.Text
extensionField_name :: Lens' ExtensionField Text
extensionField_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExtensionField' {Text
name :: Text
$sel:name:ExtensionField' :: ExtensionField -> Text
name} -> Text
name) (\s :: ExtensionField
s@ExtensionField' {} Text
a -> ExtensionField
s {$sel:name:ExtensionField' :: Text
name = Text
a} :: ExtensionField)

-- | The value of the header to add. Must be less than 2048 characters, and
-- must not contain newline characters (\"\\r\" or \"\\n\").
extensionField_value :: Lens.Lens' ExtensionField Prelude.Text
extensionField_value :: Lens' ExtensionField Text
extensionField_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExtensionField' {Text
value :: Text
$sel:value:ExtensionField' :: ExtensionField -> Text
value} -> Text
value) (\s :: ExtensionField
s@ExtensionField' {} Text
a -> ExtensionField
s {$sel:value:ExtensionField' :: Text
value = Text
a} :: ExtensionField)

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

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

instance Data.ToQuery ExtensionField where
  toQuery :: ExtensionField -> QueryString
toQuery ExtensionField' {Text
value :: Text
name :: Text
$sel:value:ExtensionField' :: ExtensionField -> Text
$sel:name:ExtensionField' :: ExtensionField -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"Name" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
name, ByteString
"Value" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
value]