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

-- | Information about how to render the content.
--
-- /See:/ 'newRenderingConfiguration' smart constructor.
data RenderingConfiguration = RenderingConfiguration'
  { -- | A URI template containing exactly one variable in
    -- @${variableName} @format. This can only be set for @EXTERNAL@ knowledge
    -- bases. For Salesforce and ServiceNow, the variable must be one of the
    -- following:
    --
    -- -   Salesforce: @Id@, @ArticleNumber@, @VersionNumber@, @Title@,
    --     @PublishStatus@, or @IsDeleted@
    --
    -- -   ServiceNow: @number@, @short_description@, @sys_mod_count@,
    --     @workflow_state@, or @active@
    --
    -- >  <p>The variable is replaced with the actual value for a piece of content when calling <a href="https://docs.aws.amazon.com/wisdom/latest/APIReference/API_GetContent.html">GetContent</a>. </p>
    RenderingConfiguration -> Maybe Text
templateUri :: Prelude.Maybe Prelude.Text
  }
  deriving (RenderingConfiguration -> RenderingConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RenderingConfiguration -> RenderingConfiguration -> Bool
$c/= :: RenderingConfiguration -> RenderingConfiguration -> Bool
== :: RenderingConfiguration -> RenderingConfiguration -> Bool
$c== :: RenderingConfiguration -> RenderingConfiguration -> Bool
Prelude.Eq, ReadPrec [RenderingConfiguration]
ReadPrec RenderingConfiguration
Int -> ReadS RenderingConfiguration
ReadS [RenderingConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RenderingConfiguration]
$creadListPrec :: ReadPrec [RenderingConfiguration]
readPrec :: ReadPrec RenderingConfiguration
$creadPrec :: ReadPrec RenderingConfiguration
readList :: ReadS [RenderingConfiguration]
$creadList :: ReadS [RenderingConfiguration]
readsPrec :: Int -> ReadS RenderingConfiguration
$creadsPrec :: Int -> ReadS RenderingConfiguration
Prelude.Read, Int -> RenderingConfiguration -> ShowS
[RenderingConfiguration] -> ShowS
RenderingConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RenderingConfiguration] -> ShowS
$cshowList :: [RenderingConfiguration] -> ShowS
show :: RenderingConfiguration -> String
$cshow :: RenderingConfiguration -> String
showsPrec :: Int -> RenderingConfiguration -> ShowS
$cshowsPrec :: Int -> RenderingConfiguration -> ShowS
Prelude.Show, forall x. Rep RenderingConfiguration x -> RenderingConfiguration
forall x. RenderingConfiguration -> Rep RenderingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RenderingConfiguration x -> RenderingConfiguration
$cfrom :: forall x. RenderingConfiguration -> Rep RenderingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'RenderingConfiguration' 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:
--
-- 'templateUri', 'renderingConfiguration_templateUri' - A URI template containing exactly one variable in
-- @${variableName} @format. This can only be set for @EXTERNAL@ knowledge
-- bases. For Salesforce and ServiceNow, the variable must be one of the
-- following:
--
-- -   Salesforce: @Id@, @ArticleNumber@, @VersionNumber@, @Title@,
--     @PublishStatus@, or @IsDeleted@
--
-- -   ServiceNow: @number@, @short_description@, @sys_mod_count@,
--     @workflow_state@, or @active@
--
-- >  <p>The variable is replaced with the actual value for a piece of content when calling <a href="https://docs.aws.amazon.com/wisdom/latest/APIReference/API_GetContent.html">GetContent</a>. </p>
newRenderingConfiguration ::
  RenderingConfiguration
newRenderingConfiguration :: RenderingConfiguration
newRenderingConfiguration =
  RenderingConfiguration'
    { $sel:templateUri:RenderingConfiguration' :: Maybe Text
templateUri =
        forall a. Maybe a
Prelude.Nothing
    }

-- | A URI template containing exactly one variable in
-- @${variableName} @format. This can only be set for @EXTERNAL@ knowledge
-- bases. For Salesforce and ServiceNow, the variable must be one of the
-- following:
--
-- -   Salesforce: @Id@, @ArticleNumber@, @VersionNumber@, @Title@,
--     @PublishStatus@, or @IsDeleted@
--
-- -   ServiceNow: @number@, @short_description@, @sys_mod_count@,
--     @workflow_state@, or @active@
--
-- >  <p>The variable is replaced with the actual value for a piece of content when calling <a href="https://docs.aws.amazon.com/wisdom/latest/APIReference/API_GetContent.html">GetContent</a>. </p>
renderingConfiguration_templateUri :: Lens.Lens' RenderingConfiguration (Prelude.Maybe Prelude.Text)
renderingConfiguration_templateUri :: Lens' RenderingConfiguration (Maybe Text)
renderingConfiguration_templateUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenderingConfiguration' {Maybe Text
templateUri :: Maybe Text
$sel:templateUri:RenderingConfiguration' :: RenderingConfiguration -> Maybe Text
templateUri} -> Maybe Text
templateUri) (\s :: RenderingConfiguration
s@RenderingConfiguration' {} Maybe Text
a -> RenderingConfiguration
s {$sel:templateUri:RenderingConfiguration' :: Maybe Text
templateUri = Maybe Text
a} :: RenderingConfiguration)

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

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

instance Prelude.NFData RenderingConfiguration where
  rnf :: RenderingConfiguration -> ()
rnf RenderingConfiguration' {Maybe Text
templateUri :: Maybe Text
$sel:templateUri:RenderingConfiguration' :: RenderingConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
templateUri

instance Data.ToJSON RenderingConfiguration where
  toJSON :: RenderingConfiguration -> Value
toJSON RenderingConfiguration' {Maybe Text
templateUri :: Maybe Text
$sel:templateUri:RenderingConfiguration' :: RenderingConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"templateUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
templateUri]
      )