{-# 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.ImportExport.Types.Artifact
-- 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.ImportExport.Types.Artifact 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

-- | A discrete item that contains the description and URL of an artifact
-- (such as a PDF).
--
-- /See:/ 'newArtifact' smart constructor.
data Artifact = Artifact'
  { Artifact -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    Artifact -> Maybe Text
url :: Prelude.Maybe Prelude.Text
  }
  deriving (Artifact -> Artifact -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Artifact -> Artifact -> Bool
$c/= :: Artifact -> Artifact -> Bool
== :: Artifact -> Artifact -> Bool
$c== :: Artifact -> Artifact -> Bool
Prelude.Eq, ReadPrec [Artifact]
ReadPrec Artifact
Int -> ReadS Artifact
ReadS [Artifact]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Artifact]
$creadListPrec :: ReadPrec [Artifact]
readPrec :: ReadPrec Artifact
$creadPrec :: ReadPrec Artifact
readList :: ReadS [Artifact]
$creadList :: ReadS [Artifact]
readsPrec :: Int -> ReadS Artifact
$creadsPrec :: Int -> ReadS Artifact
Prelude.Read, Int -> Artifact -> ShowS
[Artifact] -> ShowS
Artifact -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Artifact] -> ShowS
$cshowList :: [Artifact] -> ShowS
show :: Artifact -> String
$cshow :: Artifact -> String
showsPrec :: Int -> Artifact -> ShowS
$cshowsPrec :: Int -> Artifact -> ShowS
Prelude.Show, forall x. Rep Artifact x -> Artifact
forall x. Artifact -> Rep Artifact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Artifact x -> Artifact
$cfrom :: forall x. Artifact -> Rep Artifact x
Prelude.Generic)

-- |
-- Create a value of 'Artifact' 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:
--
-- 'description', 'artifact_description' - Undocumented member.
--
-- 'url', 'artifact_url' - Undocumented member.
newArtifact ::
  Artifact
newArtifact :: Artifact
newArtifact =
  Artifact'
    { $sel:description:Artifact' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:url:Artifact' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
artifact_description :: Lens.Lens' Artifact (Prelude.Maybe Prelude.Text)
artifact_description :: Lens' Artifact (Maybe Text)
artifact_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artifact' {Maybe Text
description :: Maybe Text
$sel:description:Artifact' :: Artifact -> Maybe Text
description} -> Maybe Text
description) (\s :: Artifact
s@Artifact' {} Maybe Text
a -> Artifact
s {$sel:description:Artifact' :: Maybe Text
description = Maybe Text
a} :: Artifact)

-- | Undocumented member.
artifact_url :: Lens.Lens' Artifact (Prelude.Maybe Prelude.Text)
artifact_url :: Lens' Artifact (Maybe Text)
artifact_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artifact' {Maybe Text
url :: Maybe Text
$sel:url:Artifact' :: Artifact -> Maybe Text
url} -> Maybe Text
url) (\s :: Artifact
s@Artifact' {} Maybe Text
a -> Artifact
s {$sel:url:Artifact' :: Maybe Text
url = Maybe Text
a} :: Artifact)

instance Data.FromXML Artifact where
  parseXML :: [Node] -> Either String Artifact
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Artifact
Artifact'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Description")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"URL")

instance Prelude.Hashable Artifact where
  hashWithSalt :: Int -> Artifact -> Int
hashWithSalt Int
_salt Artifact' {Maybe Text
url :: Maybe Text
description :: Maybe Text
$sel:url:Artifact' :: Artifact -> Maybe Text
$sel:description:Artifact' :: Artifact -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url

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