{-# 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.Pinpoint.Types.SimpleEmailPart
-- 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.Pinpoint.Types.SimpleEmailPart 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

-- | Specifies the subject or body of an email message, represented as
-- textual email data and the applicable character set.
--
-- /See:/ 'newSimpleEmailPart' smart constructor.
data SimpleEmailPart = SimpleEmailPart'
  { -- | The applicable character set for the message content.
    SimpleEmailPart -> Maybe Text
charset :: Prelude.Maybe Prelude.Text,
    -- | The textual data of the message content.
    SimpleEmailPart -> Maybe Text
data' :: Prelude.Maybe Prelude.Text
  }
  deriving (SimpleEmailPart -> SimpleEmailPart -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SimpleEmailPart -> SimpleEmailPart -> Bool
$c/= :: SimpleEmailPart -> SimpleEmailPart -> Bool
== :: SimpleEmailPart -> SimpleEmailPart -> Bool
$c== :: SimpleEmailPart -> SimpleEmailPart -> Bool
Prelude.Eq, ReadPrec [SimpleEmailPart]
ReadPrec SimpleEmailPart
Int -> ReadS SimpleEmailPart
ReadS [SimpleEmailPart]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SimpleEmailPart]
$creadListPrec :: ReadPrec [SimpleEmailPart]
readPrec :: ReadPrec SimpleEmailPart
$creadPrec :: ReadPrec SimpleEmailPart
readList :: ReadS [SimpleEmailPart]
$creadList :: ReadS [SimpleEmailPart]
readsPrec :: Int -> ReadS SimpleEmailPart
$creadsPrec :: Int -> ReadS SimpleEmailPart
Prelude.Read, Int -> SimpleEmailPart -> ShowS
[SimpleEmailPart] -> ShowS
SimpleEmailPart -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SimpleEmailPart] -> ShowS
$cshowList :: [SimpleEmailPart] -> ShowS
show :: SimpleEmailPart -> String
$cshow :: SimpleEmailPart -> String
showsPrec :: Int -> SimpleEmailPart -> ShowS
$cshowsPrec :: Int -> SimpleEmailPart -> ShowS
Prelude.Show, forall x. Rep SimpleEmailPart x -> SimpleEmailPart
forall x. SimpleEmailPart -> Rep SimpleEmailPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SimpleEmailPart x -> SimpleEmailPart
$cfrom :: forall x. SimpleEmailPart -> Rep SimpleEmailPart x
Prelude.Generic)

-- |
-- Create a value of 'SimpleEmailPart' 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:
--
-- 'charset', 'simpleEmailPart_charset' - The applicable character set for the message content.
--
-- 'data'', 'simpleEmailPart_data' - The textual data of the message content.
newSimpleEmailPart ::
  SimpleEmailPart
newSimpleEmailPart :: SimpleEmailPart
newSimpleEmailPart =
  SimpleEmailPart'
    { $sel:charset:SimpleEmailPart' :: Maybe Text
charset = forall a. Maybe a
Prelude.Nothing,
      $sel:data':SimpleEmailPart' :: Maybe Text
data' = forall a. Maybe a
Prelude.Nothing
    }

-- | The applicable character set for the message content.
simpleEmailPart_charset :: Lens.Lens' SimpleEmailPart (Prelude.Maybe Prelude.Text)
simpleEmailPart_charset :: Lens' SimpleEmailPart (Maybe Text)
simpleEmailPart_charset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SimpleEmailPart' {Maybe Text
charset :: Maybe Text
$sel:charset:SimpleEmailPart' :: SimpleEmailPart -> Maybe Text
charset} -> Maybe Text
charset) (\s :: SimpleEmailPart
s@SimpleEmailPart' {} Maybe Text
a -> SimpleEmailPart
s {$sel:charset:SimpleEmailPart' :: Maybe Text
charset = Maybe Text
a} :: SimpleEmailPart)

-- | The textual data of the message content.
simpleEmailPart_data :: Lens.Lens' SimpleEmailPart (Prelude.Maybe Prelude.Text)
simpleEmailPart_data :: Lens' SimpleEmailPart (Maybe Text)
simpleEmailPart_data = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SimpleEmailPart' {Maybe Text
data' :: Maybe Text
$sel:data':SimpleEmailPart' :: SimpleEmailPart -> Maybe Text
data'} -> Maybe Text
data') (\s :: SimpleEmailPart
s@SimpleEmailPart' {} Maybe Text
a -> SimpleEmailPart
s {$sel:data':SimpleEmailPart' :: Maybe Text
data' = Maybe Text
a} :: SimpleEmailPart)

instance Prelude.Hashable SimpleEmailPart where
  hashWithSalt :: Int -> SimpleEmailPart -> Int
hashWithSalt Int
_salt SimpleEmailPart' {Maybe Text
data' :: Maybe Text
charset :: Maybe Text
$sel:data':SimpleEmailPart' :: SimpleEmailPart -> Maybe Text
$sel:charset:SimpleEmailPart' :: SimpleEmailPart -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
charset
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
data'

instance Prelude.NFData SimpleEmailPart where
  rnf :: SimpleEmailPart -> ()
rnf SimpleEmailPart' {Maybe Text
data' :: Maybe Text
charset :: Maybe Text
$sel:data':SimpleEmailPart' :: SimpleEmailPart -> Maybe Text
$sel:charset:SimpleEmailPart' :: SimpleEmailPart -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
charset seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
data'

instance Data.ToJSON SimpleEmailPart where
  toJSON :: SimpleEmailPart -> Value
toJSON SimpleEmailPart' {Maybe Text
data' :: Maybe Text
charset :: Maybe Text
$sel:data':SimpleEmailPart' :: SimpleEmailPart -> Maybe Text
$sel:charset:SimpleEmailPart' :: SimpleEmailPart -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Charset" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
charset,
            (Key
"Data" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
data'
          ]
      )