{-# 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.Support.Types.Communication
-- 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.Support.Types.Communication where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Support.Types.AttachmentDetails

-- | A communication associated with a support case. The communication
-- consists of the case ID, the message body, attachment information, the
-- submitter of the communication, and the date and time of the
-- communication.
--
-- /See:/ 'newCommunication' smart constructor.
data Communication = Communication'
  { -- | The text of the communication between the customer and AWS Support.
    Communication -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
    -- | The support case ID requested or returned in the call. The case ID is an
    -- alphanumeric string formatted as shown in this example:
    -- case-/12345678910-2013-c4c1d2bf33c5cf47/
    Communication -> Maybe Text
caseId :: Prelude.Maybe Prelude.Text,
    -- | The identity of the account that submitted, or responded to, the support
    -- case. Customer entries include the role or IAM user as well as the email
    -- address. For example, \"AdminRole (Role) \<janedoe\@example.com>.
    -- Entries from the AWS Support team display \"Amazon Web Services,\" and
    -- don\'t show an email address.
    Communication -> Maybe Text
submittedBy :: Prelude.Maybe Prelude.Text,
    -- | The time the communication was created.
    Communication -> Maybe Text
timeCreated :: Prelude.Maybe Prelude.Text,
    -- | Information about the attachments to the case communication.
    Communication -> Maybe [AttachmentDetails]
attachmentSet :: Prelude.Maybe [AttachmentDetails]
  }
  deriving (Communication -> Communication -> Bool
(Communication -> Communication -> Bool)
-> (Communication -> Communication -> Bool) -> Eq Communication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Communication -> Communication -> Bool
$c/= :: Communication -> Communication -> Bool
== :: Communication -> Communication -> Bool
$c== :: Communication -> Communication -> Bool
Prelude.Eq, ReadPrec [Communication]
ReadPrec Communication
Int -> ReadS Communication
ReadS [Communication]
(Int -> ReadS Communication)
-> ReadS [Communication]
-> ReadPrec Communication
-> ReadPrec [Communication]
-> Read Communication
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Communication]
$creadListPrec :: ReadPrec [Communication]
readPrec :: ReadPrec Communication
$creadPrec :: ReadPrec Communication
readList :: ReadS [Communication]
$creadList :: ReadS [Communication]
readsPrec :: Int -> ReadS Communication
$creadsPrec :: Int -> ReadS Communication
Prelude.Read, Int -> Communication -> ShowS
[Communication] -> ShowS
Communication -> String
(Int -> Communication -> ShowS)
-> (Communication -> String)
-> ([Communication] -> ShowS)
-> Show Communication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Communication] -> ShowS
$cshowList :: [Communication] -> ShowS
show :: Communication -> String
$cshow :: Communication -> String
showsPrec :: Int -> Communication -> ShowS
$cshowsPrec :: Int -> Communication -> ShowS
Prelude.Show, (forall x. Communication -> Rep Communication x)
-> (forall x. Rep Communication x -> Communication)
-> Generic Communication
forall x. Rep Communication x -> Communication
forall x. Communication -> Rep Communication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Communication x -> Communication
$cfrom :: forall x. Communication -> Rep Communication x
Prelude.Generic)

-- |
-- Create a value of 'Communication' 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:
--
-- 'body', 'communication_body' - The text of the communication between the customer and AWS Support.
--
-- 'caseId', 'communication_caseId' - The support case ID requested or returned in the call. The case ID is an
-- alphanumeric string formatted as shown in this example:
-- case-/12345678910-2013-c4c1d2bf33c5cf47/
--
-- 'submittedBy', 'communication_submittedBy' - The identity of the account that submitted, or responded to, the support
-- case. Customer entries include the role or IAM user as well as the email
-- address. For example, \"AdminRole (Role) \<janedoe\@example.com>.
-- Entries from the AWS Support team display \"Amazon Web Services,\" and
-- don\'t show an email address.
--
-- 'timeCreated', 'communication_timeCreated' - The time the communication was created.
--
-- 'attachmentSet', 'communication_attachmentSet' - Information about the attachments to the case communication.
newCommunication ::
  Communication
newCommunication :: Communication
newCommunication =
  Communication' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [AttachmentDetails]
-> Communication
Communication'
    { $sel:body:Communication' :: Maybe Text
body = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:caseId:Communication' :: Maybe Text
caseId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:submittedBy:Communication' :: Maybe Text
submittedBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timeCreated:Communication' :: Maybe Text
timeCreated = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attachmentSet:Communication' :: Maybe [AttachmentDetails]
attachmentSet = Maybe [AttachmentDetails]
forall a. Maybe a
Prelude.Nothing
    }

-- | The text of the communication between the customer and AWS Support.
communication_body :: Lens.Lens' Communication (Prelude.Maybe Prelude.Text)
communication_body :: (Maybe Text -> f (Maybe Text)) -> Communication -> f Communication
communication_body = (Communication -> Maybe Text)
-> (Communication -> Maybe Text -> Communication)
-> Lens Communication Communication (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Communication' {Maybe Text
body :: Maybe Text
$sel:body:Communication' :: Communication -> Maybe Text
body} -> Maybe Text
body) (\s :: Communication
s@Communication' {} Maybe Text
a -> Communication
s {$sel:body:Communication' :: Maybe Text
body = Maybe Text
a} :: Communication)

-- | The support case ID requested or returned in the call. The case ID is an
-- alphanumeric string formatted as shown in this example:
-- case-/12345678910-2013-c4c1d2bf33c5cf47/
communication_caseId :: Lens.Lens' Communication (Prelude.Maybe Prelude.Text)
communication_caseId :: (Maybe Text -> f (Maybe Text)) -> Communication -> f Communication
communication_caseId = (Communication -> Maybe Text)
-> (Communication -> Maybe Text -> Communication)
-> Lens Communication Communication (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Communication' {Maybe Text
caseId :: Maybe Text
$sel:caseId:Communication' :: Communication -> Maybe Text
caseId} -> Maybe Text
caseId) (\s :: Communication
s@Communication' {} Maybe Text
a -> Communication
s {$sel:caseId:Communication' :: Maybe Text
caseId = Maybe Text
a} :: Communication)

-- | The identity of the account that submitted, or responded to, the support
-- case. Customer entries include the role or IAM user as well as the email
-- address. For example, \"AdminRole (Role) \<janedoe\@example.com>.
-- Entries from the AWS Support team display \"Amazon Web Services,\" and
-- don\'t show an email address.
communication_submittedBy :: Lens.Lens' Communication (Prelude.Maybe Prelude.Text)
communication_submittedBy :: (Maybe Text -> f (Maybe Text)) -> Communication -> f Communication
communication_submittedBy = (Communication -> Maybe Text)
-> (Communication -> Maybe Text -> Communication)
-> Lens Communication Communication (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Communication' {Maybe Text
submittedBy :: Maybe Text
$sel:submittedBy:Communication' :: Communication -> Maybe Text
submittedBy} -> Maybe Text
submittedBy) (\s :: Communication
s@Communication' {} Maybe Text
a -> Communication
s {$sel:submittedBy:Communication' :: Maybe Text
submittedBy = Maybe Text
a} :: Communication)

-- | The time the communication was created.
communication_timeCreated :: Lens.Lens' Communication (Prelude.Maybe Prelude.Text)
communication_timeCreated :: (Maybe Text -> f (Maybe Text)) -> Communication -> f Communication
communication_timeCreated = (Communication -> Maybe Text)
-> (Communication -> Maybe Text -> Communication)
-> Lens Communication Communication (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Communication' {Maybe Text
timeCreated :: Maybe Text
$sel:timeCreated:Communication' :: Communication -> Maybe Text
timeCreated} -> Maybe Text
timeCreated) (\s :: Communication
s@Communication' {} Maybe Text
a -> Communication
s {$sel:timeCreated:Communication' :: Maybe Text
timeCreated = Maybe Text
a} :: Communication)

-- | Information about the attachments to the case communication.
communication_attachmentSet :: Lens.Lens' Communication (Prelude.Maybe [AttachmentDetails])
communication_attachmentSet :: (Maybe [AttachmentDetails] -> f (Maybe [AttachmentDetails]))
-> Communication -> f Communication
communication_attachmentSet = (Communication -> Maybe [AttachmentDetails])
-> (Communication -> Maybe [AttachmentDetails] -> Communication)
-> Lens
     Communication
     Communication
     (Maybe [AttachmentDetails])
     (Maybe [AttachmentDetails])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Communication' {Maybe [AttachmentDetails]
attachmentSet :: Maybe [AttachmentDetails]
$sel:attachmentSet:Communication' :: Communication -> Maybe [AttachmentDetails]
attachmentSet} -> Maybe [AttachmentDetails]
attachmentSet) (\s :: Communication
s@Communication' {} Maybe [AttachmentDetails]
a -> Communication
s {$sel:attachmentSet:Communication' :: Maybe [AttachmentDetails]
attachmentSet = Maybe [AttachmentDetails]
a} :: Communication) ((Maybe [AttachmentDetails] -> f (Maybe [AttachmentDetails]))
 -> Communication -> f Communication)
-> ((Maybe [AttachmentDetails] -> f (Maybe [AttachmentDetails]))
    -> Maybe [AttachmentDetails] -> f (Maybe [AttachmentDetails]))
-> (Maybe [AttachmentDetails] -> f (Maybe [AttachmentDetails]))
-> Communication
-> f Communication
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AttachmentDetails]
  [AttachmentDetails]
  [AttachmentDetails]
  [AttachmentDetails]
-> Iso
     (Maybe [AttachmentDetails])
     (Maybe [AttachmentDetails])
     (Maybe [AttachmentDetails])
     (Maybe [AttachmentDetails])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [AttachmentDetails]
  [AttachmentDetails]
  [AttachmentDetails]
  [AttachmentDetails]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON Communication where
  parseJSON :: Value -> Parser Communication
parseJSON =
    String
-> (Object -> Parser Communication)
-> Value
-> Parser Communication
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Communication"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [AttachmentDetails]
-> Communication
Communication'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe [AttachmentDetails]
 -> Communication)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [AttachmentDetails]
      -> Communication)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"body")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [AttachmentDetails]
   -> Communication)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe [AttachmentDetails] -> Communication)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"caseId")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe [AttachmentDetails] -> Communication)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe [AttachmentDetails] -> Communication)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"submittedBy")
            Parser (Maybe Text -> Maybe [AttachmentDetails] -> Communication)
-> Parser (Maybe Text)
-> Parser (Maybe [AttachmentDetails] -> Communication)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timeCreated")
            Parser (Maybe [AttachmentDetails] -> Communication)
-> Parser (Maybe [AttachmentDetails]) -> Parser Communication
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [AttachmentDetails]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"attachmentSet" Parser (Maybe (Maybe [AttachmentDetails]))
-> Maybe [AttachmentDetails] -> Parser (Maybe [AttachmentDetails])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AttachmentDetails]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Communication

instance Prelude.NFData Communication