{-# 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.Connect.Types.AttachmentReference
-- 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.Connect.Types.AttachmentReference where

import Amazonka.Connect.Types.ReferenceStatus
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

-- | Information about a reference when the @referenceType@ is @ATTACHMENT@.
-- Otherwise, null.
--
-- /See:/ 'newAttachmentReference' smart constructor.
data AttachmentReference = AttachmentReference'
  { -- | Identifier of the attachment reference.
    AttachmentReference -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Status of the attachment reference type.
    AttachmentReference -> Maybe ReferenceStatus
status :: Prelude.Maybe ReferenceStatus,
    -- | The location path of the attachment reference.
    AttachmentReference -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (AttachmentReference -> AttachmentReference -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachmentReference -> AttachmentReference -> Bool
$c/= :: AttachmentReference -> AttachmentReference -> Bool
== :: AttachmentReference -> AttachmentReference -> Bool
$c== :: AttachmentReference -> AttachmentReference -> Bool
Prelude.Eq, ReadPrec [AttachmentReference]
ReadPrec AttachmentReference
Int -> ReadS AttachmentReference
ReadS [AttachmentReference]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachmentReference]
$creadListPrec :: ReadPrec [AttachmentReference]
readPrec :: ReadPrec AttachmentReference
$creadPrec :: ReadPrec AttachmentReference
readList :: ReadS [AttachmentReference]
$creadList :: ReadS [AttachmentReference]
readsPrec :: Int -> ReadS AttachmentReference
$creadsPrec :: Int -> ReadS AttachmentReference
Prelude.Read, Int -> AttachmentReference -> ShowS
[AttachmentReference] -> ShowS
AttachmentReference -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachmentReference] -> ShowS
$cshowList :: [AttachmentReference] -> ShowS
show :: AttachmentReference -> String
$cshow :: AttachmentReference -> String
showsPrec :: Int -> AttachmentReference -> ShowS
$cshowsPrec :: Int -> AttachmentReference -> ShowS
Prelude.Show, forall x. Rep AttachmentReference x -> AttachmentReference
forall x. AttachmentReference -> Rep AttachmentReference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachmentReference x -> AttachmentReference
$cfrom :: forall x. AttachmentReference -> Rep AttachmentReference x
Prelude.Generic)

-- |
-- Create a value of 'AttachmentReference' 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', 'attachmentReference_name' - Identifier of the attachment reference.
--
-- 'status', 'attachmentReference_status' - Status of the attachment reference type.
--
-- 'value', 'attachmentReference_value' - The location path of the attachment reference.
newAttachmentReference ::
  AttachmentReference
newAttachmentReference :: AttachmentReference
newAttachmentReference =
  AttachmentReference'
    { $sel:name:AttachmentReference' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:status:AttachmentReference' :: Maybe ReferenceStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:value:AttachmentReference' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | Identifier of the attachment reference.
attachmentReference_name :: Lens.Lens' AttachmentReference (Prelude.Maybe Prelude.Text)
attachmentReference_name :: Lens' AttachmentReference (Maybe Text)
attachmentReference_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentReference' {Maybe Text
name :: Maybe Text
$sel:name:AttachmentReference' :: AttachmentReference -> Maybe Text
name} -> Maybe Text
name) (\s :: AttachmentReference
s@AttachmentReference' {} Maybe Text
a -> AttachmentReference
s {$sel:name:AttachmentReference' :: Maybe Text
name = Maybe Text
a} :: AttachmentReference)

-- | Status of the attachment reference type.
attachmentReference_status :: Lens.Lens' AttachmentReference (Prelude.Maybe ReferenceStatus)
attachmentReference_status :: Lens' AttachmentReference (Maybe ReferenceStatus)
attachmentReference_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentReference' {Maybe ReferenceStatus
status :: Maybe ReferenceStatus
$sel:status:AttachmentReference' :: AttachmentReference -> Maybe ReferenceStatus
status} -> Maybe ReferenceStatus
status) (\s :: AttachmentReference
s@AttachmentReference' {} Maybe ReferenceStatus
a -> AttachmentReference
s {$sel:status:AttachmentReference' :: Maybe ReferenceStatus
status = Maybe ReferenceStatus
a} :: AttachmentReference)

-- | The location path of the attachment reference.
attachmentReference_value :: Lens.Lens' AttachmentReference (Prelude.Maybe Prelude.Text)
attachmentReference_value :: Lens' AttachmentReference (Maybe Text)
attachmentReference_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentReference' {Maybe Text
value :: Maybe Text
$sel:value:AttachmentReference' :: AttachmentReference -> Maybe Text
value} -> Maybe Text
value) (\s :: AttachmentReference
s@AttachmentReference' {} Maybe Text
a -> AttachmentReference
s {$sel:value:AttachmentReference' :: Maybe Text
value = Maybe Text
a} :: AttachmentReference)

instance Data.FromJSON AttachmentReference where
  parseJSON :: Value -> Parser AttachmentReference
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AttachmentReference"
      ( \Object
x ->
          Maybe Text
-> Maybe ReferenceStatus -> Maybe Text -> AttachmentReference
AttachmentReference'
            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
"Name")
            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
"Status")
            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
"Value")
      )

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

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