{-# 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.WorkMailMessageFlow.Types.RawMessageContent
-- 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.WorkMailMessageFlow.Types.RawMessageContent where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkMailMessageFlow.Types.S3Reference

-- | Provides the MIME content of the updated email message as an S3 object.
-- All MIME content must meet the following criteria:
--
-- -   Each part of a multipart MIME message must be formatted properly.
--
-- -   Attachments must be of a content type that Amazon SES supports. For
--     more information, see
--     <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/mime-types-appendix.html Unsupported Attachment Types>.
--
-- -   If any of the MIME parts in a message contain content that is
--     outside of the 7-bit ASCII character range, we recommend encoding
--     that content.
--
-- -   Per
--     <https://tools.ietf.org/html/rfc5321#section-4.5.3.1.6 RFC 5321>,
--     the maximum length of each line of text, including the \<CRLF>, must
--     not exceed 1,000 characters.
--
-- -   The message must contain all the required header fields. Check the
--     returned error message for more information.
--
-- -   The value of immutable headers must remain unchanged. Check the
--     returned error message for more information.
--
-- -   Certain unique headers can only appear once. Check the returned
--     error message for more information.
--
-- /See:/ 'newRawMessageContent' smart constructor.
data RawMessageContent = RawMessageContent'
  { -- | The S3 reference of an email message.
    RawMessageContent -> S3Reference
s3Reference :: S3Reference
  }
  deriving (RawMessageContent -> RawMessageContent -> Bool
(RawMessageContent -> RawMessageContent -> Bool)
-> (RawMessageContent -> RawMessageContent -> Bool)
-> Eq RawMessageContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RawMessageContent -> RawMessageContent -> Bool
$c/= :: RawMessageContent -> RawMessageContent -> Bool
== :: RawMessageContent -> RawMessageContent -> Bool
$c== :: RawMessageContent -> RawMessageContent -> Bool
Prelude.Eq, ReadPrec [RawMessageContent]
ReadPrec RawMessageContent
Int -> ReadS RawMessageContent
ReadS [RawMessageContent]
(Int -> ReadS RawMessageContent)
-> ReadS [RawMessageContent]
-> ReadPrec RawMessageContent
-> ReadPrec [RawMessageContent]
-> Read RawMessageContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RawMessageContent]
$creadListPrec :: ReadPrec [RawMessageContent]
readPrec :: ReadPrec RawMessageContent
$creadPrec :: ReadPrec RawMessageContent
readList :: ReadS [RawMessageContent]
$creadList :: ReadS [RawMessageContent]
readsPrec :: Int -> ReadS RawMessageContent
$creadsPrec :: Int -> ReadS RawMessageContent
Prelude.Read, Int -> RawMessageContent -> ShowS
[RawMessageContent] -> ShowS
RawMessageContent -> String
(Int -> RawMessageContent -> ShowS)
-> (RawMessageContent -> String)
-> ([RawMessageContent] -> ShowS)
-> Show RawMessageContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RawMessageContent] -> ShowS
$cshowList :: [RawMessageContent] -> ShowS
show :: RawMessageContent -> String
$cshow :: RawMessageContent -> String
showsPrec :: Int -> RawMessageContent -> ShowS
$cshowsPrec :: Int -> RawMessageContent -> ShowS
Prelude.Show, (forall x. RawMessageContent -> Rep RawMessageContent x)
-> (forall x. Rep RawMessageContent x -> RawMessageContent)
-> Generic RawMessageContent
forall x. Rep RawMessageContent x -> RawMessageContent
forall x. RawMessageContent -> Rep RawMessageContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RawMessageContent x -> RawMessageContent
$cfrom :: forall x. RawMessageContent -> Rep RawMessageContent x
Prelude.Generic)

-- |
-- Create a value of 'RawMessageContent' 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:
--
-- 's3Reference', 'rawMessageContent_s3Reference' - The S3 reference of an email message.
newRawMessageContent ::
  -- | 's3Reference'
  S3Reference ->
  RawMessageContent
newRawMessageContent :: S3Reference -> RawMessageContent
newRawMessageContent S3Reference
pS3Reference_ =
  RawMessageContent' :: S3Reference -> RawMessageContent
RawMessageContent' {$sel:s3Reference:RawMessageContent' :: S3Reference
s3Reference = S3Reference
pS3Reference_}

-- | The S3 reference of an email message.
rawMessageContent_s3Reference :: Lens.Lens' RawMessageContent S3Reference
rawMessageContent_s3Reference :: (S3Reference -> f S3Reference)
-> RawMessageContent -> f RawMessageContent
rawMessageContent_s3Reference = (RawMessageContent -> S3Reference)
-> (RawMessageContent -> S3Reference -> RawMessageContent)
-> Lens RawMessageContent RawMessageContent S3Reference S3Reference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RawMessageContent' {S3Reference
s3Reference :: S3Reference
$sel:s3Reference:RawMessageContent' :: RawMessageContent -> S3Reference
s3Reference} -> S3Reference
s3Reference) (\s :: RawMessageContent
s@RawMessageContent' {} S3Reference
a -> RawMessageContent
s {$sel:s3Reference:RawMessageContent' :: S3Reference
s3Reference = S3Reference
a} :: RawMessageContent)

instance Prelude.Hashable RawMessageContent

instance Prelude.NFData RawMessageContent

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