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

-- | The file name and ID of an attachment to a case communication. You can
-- use the ID to retrieve the attachment with the DescribeAttachment
-- operation.
--
-- /See:/ 'newAttachmentDetails' smart constructor.
data AttachmentDetails = AttachmentDetails'
  { -- | The ID of the attachment.
    AttachmentDetails -> Maybe Text
attachmentId :: Prelude.Maybe Prelude.Text,
    -- | The file name of the attachment.
    AttachmentDetails -> Maybe Text
fileName :: Prelude.Maybe Prelude.Text
  }
  deriving (AttachmentDetails -> AttachmentDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachmentDetails -> AttachmentDetails -> Bool
$c/= :: AttachmentDetails -> AttachmentDetails -> Bool
== :: AttachmentDetails -> AttachmentDetails -> Bool
$c== :: AttachmentDetails -> AttachmentDetails -> Bool
Prelude.Eq, ReadPrec [AttachmentDetails]
ReadPrec AttachmentDetails
Int -> ReadS AttachmentDetails
ReadS [AttachmentDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachmentDetails]
$creadListPrec :: ReadPrec [AttachmentDetails]
readPrec :: ReadPrec AttachmentDetails
$creadPrec :: ReadPrec AttachmentDetails
readList :: ReadS [AttachmentDetails]
$creadList :: ReadS [AttachmentDetails]
readsPrec :: Int -> ReadS AttachmentDetails
$creadsPrec :: Int -> ReadS AttachmentDetails
Prelude.Read, Int -> AttachmentDetails -> ShowS
[AttachmentDetails] -> ShowS
AttachmentDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachmentDetails] -> ShowS
$cshowList :: [AttachmentDetails] -> ShowS
show :: AttachmentDetails -> String
$cshow :: AttachmentDetails -> String
showsPrec :: Int -> AttachmentDetails -> ShowS
$cshowsPrec :: Int -> AttachmentDetails -> ShowS
Prelude.Show, forall x. Rep AttachmentDetails x -> AttachmentDetails
forall x. AttachmentDetails -> Rep AttachmentDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachmentDetails x -> AttachmentDetails
$cfrom :: forall x. AttachmentDetails -> Rep AttachmentDetails x
Prelude.Generic)

-- |
-- Create a value of 'AttachmentDetails' 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:
--
-- 'attachmentId', 'attachmentDetails_attachmentId' - The ID of the attachment.
--
-- 'fileName', 'attachmentDetails_fileName' - The file name of the attachment.
newAttachmentDetails ::
  AttachmentDetails
newAttachmentDetails :: AttachmentDetails
newAttachmentDetails =
  AttachmentDetails'
    { $sel:attachmentId:AttachmentDetails' :: Maybe Text
attachmentId = forall a. Maybe a
Prelude.Nothing,
      $sel:fileName:AttachmentDetails' :: Maybe Text
fileName = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the attachment.
attachmentDetails_attachmentId :: Lens.Lens' AttachmentDetails (Prelude.Maybe Prelude.Text)
attachmentDetails_attachmentId :: Lens' AttachmentDetails (Maybe Text)
attachmentDetails_attachmentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentDetails' {Maybe Text
attachmentId :: Maybe Text
$sel:attachmentId:AttachmentDetails' :: AttachmentDetails -> Maybe Text
attachmentId} -> Maybe Text
attachmentId) (\s :: AttachmentDetails
s@AttachmentDetails' {} Maybe Text
a -> AttachmentDetails
s {$sel:attachmentId:AttachmentDetails' :: Maybe Text
attachmentId = Maybe Text
a} :: AttachmentDetails)

-- | The file name of the attachment.
attachmentDetails_fileName :: Lens.Lens' AttachmentDetails (Prelude.Maybe Prelude.Text)
attachmentDetails_fileName :: Lens' AttachmentDetails (Maybe Text)
attachmentDetails_fileName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentDetails' {Maybe Text
fileName :: Maybe Text
$sel:fileName:AttachmentDetails' :: AttachmentDetails -> Maybe Text
fileName} -> Maybe Text
fileName) (\s :: AttachmentDetails
s@AttachmentDetails' {} Maybe Text
a -> AttachmentDetails
s {$sel:fileName:AttachmentDetails' :: Maybe Text
fileName = Maybe Text
a} :: AttachmentDetails)

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

instance Prelude.Hashable AttachmentDetails where
  hashWithSalt :: Int -> AttachmentDetails -> Int
hashWithSalt Int
_salt AttachmentDetails' {Maybe Text
fileName :: Maybe Text
attachmentId :: Maybe Text
$sel:fileName:AttachmentDetails' :: AttachmentDetails -> Maybe Text
$sel:attachmentId:AttachmentDetails' :: AttachmentDetails -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
attachmentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fileName

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