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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(RenderingConfiguration -> RenderingConfiguration -> Bool)
-> (RenderingConfiguration -> RenderingConfiguration -> Bool)
-> Eq RenderingConfiguration
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]
(Int -> ReadS RenderingConfiguration)
-> ReadS [RenderingConfiguration]
-> ReadPrec RenderingConfiguration
-> ReadPrec [RenderingConfiguration]
-> Read 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
(Int -> RenderingConfiguration -> ShowS)
-> (RenderingConfiguration -> String)
-> ([RenderingConfiguration] -> ShowS)
-> Show RenderingConfiguration
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. RenderingConfiguration -> Rep RenderingConfiguration x)
-> (forall x.
    Rep RenderingConfiguration x -> RenderingConfiguration)
-> Generic RenderingConfiguration
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' :: Maybe Text -> RenderingConfiguration
RenderingConfiguration'
    { $sel:templateUri:RenderingConfiguration' :: Maybe Text
templateUri =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> RenderingConfiguration -> f RenderingConfiguration
renderingConfiguration_templateUri = (RenderingConfiguration -> Maybe Text)
-> (RenderingConfiguration -> Maybe Text -> RenderingConfiguration)
-> Lens
     RenderingConfiguration
     RenderingConfiguration
     (Maybe Text)
     (Maybe Text)
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 Core.FromJSON RenderingConfiguration where
  parseJSON :: Value -> Parser RenderingConfiguration
parseJSON =
    String
-> (Object -> Parser RenderingConfiguration)
-> Value
-> Parser RenderingConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RenderingConfiguration"
      ( \Object
x ->
          Maybe Text -> RenderingConfiguration
RenderingConfiguration'
            (Maybe Text -> RenderingConfiguration)
-> Parser (Maybe Text) -> Parser RenderingConfiguration
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
"templateUri")
      )

instance Prelude.Hashable RenderingConfiguration

instance Prelude.NFData RenderingConfiguration

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