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

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

-- | Configuration information for Amazon AppIntegrations to automatically
-- ingest content.
--
-- /See:/ 'newAppIntegrationsConfiguration' smart constructor.
data AppIntegrationsConfiguration = AppIntegrationsConfiguration'
  { -- | The Amazon Resource Name (ARN) of the AppIntegrations DataIntegration to
    -- use for ingesting content.
    AppIntegrationsConfiguration -> Text
appIntegrationArn :: Prelude.Text,
    -- | The fields from the source that are made available to your agents in
    -- Wisdom.
    --
    -- -   For
    --     <https://developer.salesforce.com/docs/atlas.en-us.knowledge_dev.meta/knowledge_dev/sforce_api_objects_knowledge__kav.htm Salesforce>,
    --     you must include at least @Id@, @ArticleNumber@, @VersionNumber@,
    --     @Title@, @PublishStatus@, and @IsDeleted@.
    --
    -- -   For
    --     <https://developer.servicenow.com/dev.do#!/reference/api/rome/rest/knowledge-management-api ServiceNow>,
    --     you must include at least @number@, @short_description@,
    --     @sys_mod_count@, @workflow_state@, and @active@.
    --
    -- Make sure to include additional field(s); these are indexed and used to
    -- source recommendations.
    AppIntegrationsConfiguration -> NonEmpty Text
objectFields :: Prelude.NonEmpty Prelude.Text
  }
  deriving (AppIntegrationsConfiguration
-> AppIntegrationsConfiguration -> Bool
(AppIntegrationsConfiguration
 -> AppIntegrationsConfiguration -> Bool)
-> (AppIntegrationsConfiguration
    -> AppIntegrationsConfiguration -> Bool)
-> Eq AppIntegrationsConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppIntegrationsConfiguration
-> AppIntegrationsConfiguration -> Bool
$c/= :: AppIntegrationsConfiguration
-> AppIntegrationsConfiguration -> Bool
== :: AppIntegrationsConfiguration
-> AppIntegrationsConfiguration -> Bool
$c== :: AppIntegrationsConfiguration
-> AppIntegrationsConfiguration -> Bool
Prelude.Eq, ReadPrec [AppIntegrationsConfiguration]
ReadPrec AppIntegrationsConfiguration
Int -> ReadS AppIntegrationsConfiguration
ReadS [AppIntegrationsConfiguration]
(Int -> ReadS AppIntegrationsConfiguration)
-> ReadS [AppIntegrationsConfiguration]
-> ReadPrec AppIntegrationsConfiguration
-> ReadPrec [AppIntegrationsConfiguration]
-> Read AppIntegrationsConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AppIntegrationsConfiguration]
$creadListPrec :: ReadPrec [AppIntegrationsConfiguration]
readPrec :: ReadPrec AppIntegrationsConfiguration
$creadPrec :: ReadPrec AppIntegrationsConfiguration
readList :: ReadS [AppIntegrationsConfiguration]
$creadList :: ReadS [AppIntegrationsConfiguration]
readsPrec :: Int -> ReadS AppIntegrationsConfiguration
$creadsPrec :: Int -> ReadS AppIntegrationsConfiguration
Prelude.Read, Int -> AppIntegrationsConfiguration -> ShowS
[AppIntegrationsConfiguration] -> ShowS
AppIntegrationsConfiguration -> String
(Int -> AppIntegrationsConfiguration -> ShowS)
-> (AppIntegrationsConfiguration -> String)
-> ([AppIntegrationsConfiguration] -> ShowS)
-> Show AppIntegrationsConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppIntegrationsConfiguration] -> ShowS
$cshowList :: [AppIntegrationsConfiguration] -> ShowS
show :: AppIntegrationsConfiguration -> String
$cshow :: AppIntegrationsConfiguration -> String
showsPrec :: Int -> AppIntegrationsConfiguration -> ShowS
$cshowsPrec :: Int -> AppIntegrationsConfiguration -> ShowS
Prelude.Show, (forall x.
 AppIntegrationsConfiguration -> Rep AppIntegrationsConfiguration x)
-> (forall x.
    Rep AppIntegrationsConfiguration x -> AppIntegrationsConfiguration)
-> Generic AppIntegrationsConfiguration
forall x.
Rep AppIntegrationsConfiguration x -> AppIntegrationsConfiguration
forall x.
AppIntegrationsConfiguration -> Rep AppIntegrationsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AppIntegrationsConfiguration x -> AppIntegrationsConfiguration
$cfrom :: forall x.
AppIntegrationsConfiguration -> Rep AppIntegrationsConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'AppIntegrationsConfiguration' 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:
--
-- 'appIntegrationArn', 'appIntegrationsConfiguration_appIntegrationArn' - The Amazon Resource Name (ARN) of the AppIntegrations DataIntegration to
-- use for ingesting content.
--
-- 'objectFields', 'appIntegrationsConfiguration_objectFields' - The fields from the source that are made available to your agents in
-- Wisdom.
--
-- -   For
--     <https://developer.salesforce.com/docs/atlas.en-us.knowledge_dev.meta/knowledge_dev/sforce_api_objects_knowledge__kav.htm Salesforce>,
--     you must include at least @Id@, @ArticleNumber@, @VersionNumber@,
--     @Title@, @PublishStatus@, and @IsDeleted@.
--
-- -   For
--     <https://developer.servicenow.com/dev.do#!/reference/api/rome/rest/knowledge-management-api ServiceNow>,
--     you must include at least @number@, @short_description@,
--     @sys_mod_count@, @workflow_state@, and @active@.
--
-- Make sure to include additional field(s); these are indexed and used to
-- source recommendations.
newAppIntegrationsConfiguration ::
  -- | 'appIntegrationArn'
  Prelude.Text ->
  -- | 'objectFields'
  Prelude.NonEmpty Prelude.Text ->
  AppIntegrationsConfiguration
newAppIntegrationsConfiguration :: Text -> NonEmpty Text -> AppIntegrationsConfiguration
newAppIntegrationsConfiguration
  Text
pAppIntegrationArn_
  NonEmpty Text
pObjectFields_ =
    AppIntegrationsConfiguration' :: Text -> NonEmpty Text -> AppIntegrationsConfiguration
AppIntegrationsConfiguration'
      { $sel:appIntegrationArn:AppIntegrationsConfiguration' :: Text
appIntegrationArn =
          Text
pAppIntegrationArn_,
        $sel:objectFields:AppIntegrationsConfiguration' :: NonEmpty Text
objectFields =
          Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pObjectFields_
      }

-- | The Amazon Resource Name (ARN) of the AppIntegrations DataIntegration to
-- use for ingesting content.
appIntegrationsConfiguration_appIntegrationArn :: Lens.Lens' AppIntegrationsConfiguration Prelude.Text
appIntegrationsConfiguration_appIntegrationArn :: (Text -> f Text)
-> AppIntegrationsConfiguration -> f AppIntegrationsConfiguration
appIntegrationsConfiguration_appIntegrationArn = (AppIntegrationsConfiguration -> Text)
-> (AppIntegrationsConfiguration
    -> Text -> AppIntegrationsConfiguration)
-> Lens
     AppIntegrationsConfiguration AppIntegrationsConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppIntegrationsConfiguration' {Text
appIntegrationArn :: Text
$sel:appIntegrationArn:AppIntegrationsConfiguration' :: AppIntegrationsConfiguration -> Text
appIntegrationArn} -> Text
appIntegrationArn) (\s :: AppIntegrationsConfiguration
s@AppIntegrationsConfiguration' {} Text
a -> AppIntegrationsConfiguration
s {$sel:appIntegrationArn:AppIntegrationsConfiguration' :: Text
appIntegrationArn = Text
a} :: AppIntegrationsConfiguration)

-- | The fields from the source that are made available to your agents in
-- Wisdom.
--
-- -   For
--     <https://developer.salesforce.com/docs/atlas.en-us.knowledge_dev.meta/knowledge_dev/sforce_api_objects_knowledge__kav.htm Salesforce>,
--     you must include at least @Id@, @ArticleNumber@, @VersionNumber@,
--     @Title@, @PublishStatus@, and @IsDeleted@.
--
-- -   For
--     <https://developer.servicenow.com/dev.do#!/reference/api/rome/rest/knowledge-management-api ServiceNow>,
--     you must include at least @number@, @short_description@,
--     @sys_mod_count@, @workflow_state@, and @active@.
--
-- Make sure to include additional field(s); these are indexed and used to
-- source recommendations.
appIntegrationsConfiguration_objectFields :: Lens.Lens' AppIntegrationsConfiguration (Prelude.NonEmpty Prelude.Text)
appIntegrationsConfiguration_objectFields :: (NonEmpty Text -> f (NonEmpty Text))
-> AppIntegrationsConfiguration -> f AppIntegrationsConfiguration
appIntegrationsConfiguration_objectFields = (AppIntegrationsConfiguration -> NonEmpty Text)
-> (AppIntegrationsConfiguration
    -> NonEmpty Text -> AppIntegrationsConfiguration)
-> Lens
     AppIntegrationsConfiguration
     AppIntegrationsConfiguration
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppIntegrationsConfiguration' {NonEmpty Text
objectFields :: NonEmpty Text
$sel:objectFields:AppIntegrationsConfiguration' :: AppIntegrationsConfiguration -> NonEmpty Text
objectFields} -> NonEmpty Text
objectFields) (\s :: AppIntegrationsConfiguration
s@AppIntegrationsConfiguration' {} NonEmpty Text
a -> AppIntegrationsConfiguration
s {$sel:objectFields:AppIntegrationsConfiguration' :: NonEmpty Text
objectFields = NonEmpty Text
a} :: AppIntegrationsConfiguration) ((NonEmpty Text -> f (NonEmpty Text))
 -> AppIntegrationsConfiguration -> f AppIntegrationsConfiguration)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> AppIntegrationsConfiguration
-> f AppIntegrationsConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON AppIntegrationsConfiguration where
  parseJSON :: Value -> Parser AppIntegrationsConfiguration
parseJSON =
    String
-> (Object -> Parser AppIntegrationsConfiguration)
-> Value
-> Parser AppIntegrationsConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AppIntegrationsConfiguration"
      ( \Object
x ->
          Text -> NonEmpty Text -> AppIntegrationsConfiguration
AppIntegrationsConfiguration'
            (Text -> NonEmpty Text -> AppIntegrationsConfiguration)
-> Parser Text
-> Parser (NonEmpty Text -> AppIntegrationsConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"appIntegrationArn")
            Parser (NonEmpty Text -> AppIntegrationsConfiguration)
-> Parser (NonEmpty Text) -> Parser AppIntegrationsConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"objectFields")
      )

instance
  Prelude.Hashable
    AppIntegrationsConfiguration

instance Prelude.NFData AppIntegrationsConfiguration

instance Core.ToJSON AppIntegrationsConfiguration where
  toJSON :: AppIntegrationsConfiguration -> Value
toJSON AppIntegrationsConfiguration' {NonEmpty Text
Text
objectFields :: NonEmpty Text
appIntegrationArn :: Text
$sel:objectFields:AppIntegrationsConfiguration' :: AppIntegrationsConfiguration -> NonEmpty Text
$sel:appIntegrationArn:AppIntegrationsConfiguration' :: AppIntegrationsConfiguration -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"appIntegrationArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
appIntegrationArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"objectFields" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
objectFields)
          ]
      )