{-# 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.Wisdom.Types.ContentReference
-- 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.Wisdom.Types.ContentReference where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Reference information about the content.
--
-- /See:/ 'newContentReference' smart constructor.
data ContentReference = ContentReference'
  { -- | The Amazon Resource Name (ARN) of the content.
    ContentReference -> Maybe Text
contentArn :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the content.
    ContentReference -> Maybe Text
contentId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the knowledge base.
    ContentReference -> Maybe Text
knowledgeBaseArn :: Prelude.Maybe Prelude.Text,
    -- | The the identifier of the knowledge base.
    ContentReference -> Maybe Text
knowledgeBaseId :: Prelude.Maybe Prelude.Text
  }
  deriving (ContentReference -> ContentReference -> Bool
(ContentReference -> ContentReference -> Bool)
-> (ContentReference -> ContentReference -> Bool)
-> Eq ContentReference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContentReference -> ContentReference -> Bool
$c/= :: ContentReference -> ContentReference -> Bool
== :: ContentReference -> ContentReference -> Bool
$c== :: ContentReference -> ContentReference -> Bool
Prelude.Eq, ReadPrec [ContentReference]
ReadPrec ContentReference
Int -> ReadS ContentReference
ReadS [ContentReference]
(Int -> ReadS ContentReference)
-> ReadS [ContentReference]
-> ReadPrec ContentReference
-> ReadPrec [ContentReference]
-> Read ContentReference
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContentReference]
$creadListPrec :: ReadPrec [ContentReference]
readPrec :: ReadPrec ContentReference
$creadPrec :: ReadPrec ContentReference
readList :: ReadS [ContentReference]
$creadList :: ReadS [ContentReference]
readsPrec :: Int -> ReadS ContentReference
$creadsPrec :: Int -> ReadS ContentReference
Prelude.Read, Int -> ContentReference -> ShowS
[ContentReference] -> ShowS
ContentReference -> String
(Int -> ContentReference -> ShowS)
-> (ContentReference -> String)
-> ([ContentReference] -> ShowS)
-> Show ContentReference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContentReference] -> ShowS
$cshowList :: [ContentReference] -> ShowS
show :: ContentReference -> String
$cshow :: ContentReference -> String
showsPrec :: Int -> ContentReference -> ShowS
$cshowsPrec :: Int -> ContentReference -> ShowS
Prelude.Show, (forall x. ContentReference -> Rep ContentReference x)
-> (forall x. Rep ContentReference x -> ContentReference)
-> Generic ContentReference
forall x. Rep ContentReference x -> ContentReference
forall x. ContentReference -> Rep ContentReference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContentReference x -> ContentReference
$cfrom :: forall x. ContentReference -> Rep ContentReference x
Prelude.Generic)

-- |
-- Create a value of 'ContentReference' 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:
--
-- 'contentArn', 'contentReference_contentArn' - The Amazon Resource Name (ARN) of the content.
--
-- 'contentId', 'contentReference_contentId' - The identifier of the content.
--
-- 'knowledgeBaseArn', 'contentReference_knowledgeBaseArn' - The Amazon Resource Name (ARN) of the knowledge base.
--
-- 'knowledgeBaseId', 'contentReference_knowledgeBaseId' - The the identifier of the knowledge base.
newContentReference ::
  ContentReference
newContentReference :: ContentReference
newContentReference =
  ContentReference' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> ContentReference
ContentReference'
    { $sel:contentArn:ContentReference' :: Maybe Text
contentArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:contentId:ContentReference' :: Maybe Text
contentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:knowledgeBaseArn:ContentReference' :: Maybe Text
knowledgeBaseArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:knowledgeBaseId:ContentReference' :: Maybe Text
knowledgeBaseId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the content.
contentReference_contentArn :: Lens.Lens' ContentReference (Prelude.Maybe Prelude.Text)
contentReference_contentArn :: (Maybe Text -> f (Maybe Text))
-> ContentReference -> f ContentReference
contentReference_contentArn = (ContentReference -> Maybe Text)
-> (ContentReference -> Maybe Text -> ContentReference)
-> Lens ContentReference ContentReference (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentReference' {Maybe Text
contentArn :: Maybe Text
$sel:contentArn:ContentReference' :: ContentReference -> Maybe Text
contentArn} -> Maybe Text
contentArn) (\s :: ContentReference
s@ContentReference' {} Maybe Text
a -> ContentReference
s {$sel:contentArn:ContentReference' :: Maybe Text
contentArn = Maybe Text
a} :: ContentReference)

-- | The identifier of the content.
contentReference_contentId :: Lens.Lens' ContentReference (Prelude.Maybe Prelude.Text)
contentReference_contentId :: (Maybe Text -> f (Maybe Text))
-> ContentReference -> f ContentReference
contentReference_contentId = (ContentReference -> Maybe Text)
-> (ContentReference -> Maybe Text -> ContentReference)
-> Lens ContentReference ContentReference (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentReference' {Maybe Text
contentId :: Maybe Text
$sel:contentId:ContentReference' :: ContentReference -> Maybe Text
contentId} -> Maybe Text
contentId) (\s :: ContentReference
s@ContentReference' {} Maybe Text
a -> ContentReference
s {$sel:contentId:ContentReference' :: Maybe Text
contentId = Maybe Text
a} :: ContentReference)

-- | The Amazon Resource Name (ARN) of the knowledge base.
contentReference_knowledgeBaseArn :: Lens.Lens' ContentReference (Prelude.Maybe Prelude.Text)
contentReference_knowledgeBaseArn :: (Maybe Text -> f (Maybe Text))
-> ContentReference -> f ContentReference
contentReference_knowledgeBaseArn = (ContentReference -> Maybe Text)
-> (ContentReference -> Maybe Text -> ContentReference)
-> Lens ContentReference ContentReference (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentReference' {Maybe Text
knowledgeBaseArn :: Maybe Text
$sel:knowledgeBaseArn:ContentReference' :: ContentReference -> Maybe Text
knowledgeBaseArn} -> Maybe Text
knowledgeBaseArn) (\s :: ContentReference
s@ContentReference' {} Maybe Text
a -> ContentReference
s {$sel:knowledgeBaseArn:ContentReference' :: Maybe Text
knowledgeBaseArn = Maybe Text
a} :: ContentReference)

-- | The the identifier of the knowledge base.
contentReference_knowledgeBaseId :: Lens.Lens' ContentReference (Prelude.Maybe Prelude.Text)
contentReference_knowledgeBaseId :: (Maybe Text -> f (Maybe Text))
-> ContentReference -> f ContentReference
contentReference_knowledgeBaseId = (ContentReference -> Maybe Text)
-> (ContentReference -> Maybe Text -> ContentReference)
-> Lens ContentReference ContentReference (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentReference' {Maybe Text
knowledgeBaseId :: Maybe Text
$sel:knowledgeBaseId:ContentReference' :: ContentReference -> Maybe Text
knowledgeBaseId} -> Maybe Text
knowledgeBaseId) (\s :: ContentReference
s@ContentReference' {} Maybe Text
a -> ContentReference
s {$sel:knowledgeBaseId:ContentReference' :: Maybe Text
knowledgeBaseId = Maybe Text
a} :: ContentReference)

instance Core.FromJSON ContentReference where
  parseJSON :: Value -> Parser ContentReference
parseJSON =
    String
-> (Object -> Parser ContentReference)
-> Value
-> Parser ContentReference
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContentReference"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> ContentReference
ContentReference'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> ContentReference)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ContentReference)
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
"contentArn")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> ContentReference)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ContentReference)
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
"contentId")
            Parser (Maybe Text -> Maybe Text -> ContentReference)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ContentReference)
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
"knowledgeBaseArn")
            Parser (Maybe Text -> ContentReference)
-> Parser (Maybe Text) -> Parser ContentReference
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
"knowledgeBaseId")
      )

instance Prelude.Hashable ContentReference

instance Prelude.NFData ContentReference