{-# 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.Kendra.Types.SalesforceChatterFeedConfiguration
-- 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.Kendra.Types.SalesforceChatterFeedConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kendra.Types.DataSourceToIndexFieldMapping
import Amazonka.Kendra.Types.SalesforceChatterFeedIncludeFilterType
import qualified Amazonka.Prelude as Prelude

-- | The configuration information for syncing a Salesforce chatter feed. The
-- contents of the object comes from the Salesforce FeedItem table.
--
-- /See:/ 'newSalesforceChatterFeedConfiguration' smart constructor.
data SalesforceChatterFeedConfiguration = SalesforceChatterFeedConfiguration'
  { -- | The name of the column in the Salesforce FeedItem table that contains
    -- the title of the document. This is typically the @Title@ column.
    SalesforceChatterFeedConfiguration -> Maybe Text
documentTitleFieldName :: Prelude.Maybe Prelude.Text,
    -- | Maps fields from a Salesforce chatter feed into Amazon Kendra index
    -- fields.
    SalesforceChatterFeedConfiguration
-> Maybe (NonEmpty DataSourceToIndexFieldMapping)
fieldMappings :: Prelude.Maybe (Prelude.NonEmpty DataSourceToIndexFieldMapping),
    -- | Filters the documents in the feed based on status of the user. When you
    -- specify @ACTIVE_USERS@ only documents from users who have an active
    -- account are indexed. When you specify @STANDARD_USER@ only documents for
    -- Salesforce standard users are documented. You can specify both.
    SalesforceChatterFeedConfiguration
-> Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
includeFilterTypes :: Prelude.Maybe (Prelude.NonEmpty SalesforceChatterFeedIncludeFilterType),
    -- | The name of the column in the Salesforce FeedItem table that contains
    -- the content to index. Typically this is the @Body@ column.
    SalesforceChatterFeedConfiguration -> Text
documentDataFieldName :: Prelude.Text
  }
  deriving (SalesforceChatterFeedConfiguration
-> SalesforceChatterFeedConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SalesforceChatterFeedConfiguration
-> SalesforceChatterFeedConfiguration -> Bool
$c/= :: SalesforceChatterFeedConfiguration
-> SalesforceChatterFeedConfiguration -> Bool
== :: SalesforceChatterFeedConfiguration
-> SalesforceChatterFeedConfiguration -> Bool
$c== :: SalesforceChatterFeedConfiguration
-> SalesforceChatterFeedConfiguration -> Bool
Prelude.Eq, ReadPrec [SalesforceChatterFeedConfiguration]
ReadPrec SalesforceChatterFeedConfiguration
Int -> ReadS SalesforceChatterFeedConfiguration
ReadS [SalesforceChatterFeedConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SalesforceChatterFeedConfiguration]
$creadListPrec :: ReadPrec [SalesforceChatterFeedConfiguration]
readPrec :: ReadPrec SalesforceChatterFeedConfiguration
$creadPrec :: ReadPrec SalesforceChatterFeedConfiguration
readList :: ReadS [SalesforceChatterFeedConfiguration]
$creadList :: ReadS [SalesforceChatterFeedConfiguration]
readsPrec :: Int -> ReadS SalesforceChatterFeedConfiguration
$creadsPrec :: Int -> ReadS SalesforceChatterFeedConfiguration
Prelude.Read, Int -> SalesforceChatterFeedConfiguration -> ShowS
[SalesforceChatterFeedConfiguration] -> ShowS
SalesforceChatterFeedConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SalesforceChatterFeedConfiguration] -> ShowS
$cshowList :: [SalesforceChatterFeedConfiguration] -> ShowS
show :: SalesforceChatterFeedConfiguration -> String
$cshow :: SalesforceChatterFeedConfiguration -> String
showsPrec :: Int -> SalesforceChatterFeedConfiguration -> ShowS
$cshowsPrec :: Int -> SalesforceChatterFeedConfiguration -> ShowS
Prelude.Show, forall x.
Rep SalesforceChatterFeedConfiguration x
-> SalesforceChatterFeedConfiguration
forall x.
SalesforceChatterFeedConfiguration
-> Rep SalesforceChatterFeedConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SalesforceChatterFeedConfiguration x
-> SalesforceChatterFeedConfiguration
$cfrom :: forall x.
SalesforceChatterFeedConfiguration
-> Rep SalesforceChatterFeedConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SalesforceChatterFeedConfiguration' 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:
--
-- 'documentTitleFieldName', 'salesforceChatterFeedConfiguration_documentTitleFieldName' - The name of the column in the Salesforce FeedItem table that contains
-- the title of the document. This is typically the @Title@ column.
--
-- 'fieldMappings', 'salesforceChatterFeedConfiguration_fieldMappings' - Maps fields from a Salesforce chatter feed into Amazon Kendra index
-- fields.
--
-- 'includeFilterTypes', 'salesforceChatterFeedConfiguration_includeFilterTypes' - Filters the documents in the feed based on status of the user. When you
-- specify @ACTIVE_USERS@ only documents from users who have an active
-- account are indexed. When you specify @STANDARD_USER@ only documents for
-- Salesforce standard users are documented. You can specify both.
--
-- 'documentDataFieldName', 'salesforceChatterFeedConfiguration_documentDataFieldName' - The name of the column in the Salesforce FeedItem table that contains
-- the content to index. Typically this is the @Body@ column.
newSalesforceChatterFeedConfiguration ::
  -- | 'documentDataFieldName'
  Prelude.Text ->
  SalesforceChatterFeedConfiguration
newSalesforceChatterFeedConfiguration :: Text -> SalesforceChatterFeedConfiguration
newSalesforceChatterFeedConfiguration
  Text
pDocumentDataFieldName_ =
    SalesforceChatterFeedConfiguration'
      { $sel:documentTitleFieldName:SalesforceChatterFeedConfiguration' :: Maybe Text
documentTitleFieldName =
          forall a. Maybe a
Prelude.Nothing,
        $sel:fieldMappings:SalesforceChatterFeedConfiguration' :: Maybe (NonEmpty DataSourceToIndexFieldMapping)
fieldMappings = forall a. Maybe a
Prelude.Nothing,
        $sel:includeFilterTypes:SalesforceChatterFeedConfiguration' :: Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
includeFilterTypes = forall a. Maybe a
Prelude.Nothing,
        $sel:documentDataFieldName:SalesforceChatterFeedConfiguration' :: Text
documentDataFieldName =
          Text
pDocumentDataFieldName_
      }

-- | The name of the column in the Salesforce FeedItem table that contains
-- the title of the document. This is typically the @Title@ column.
salesforceChatterFeedConfiguration_documentTitleFieldName :: Lens.Lens' SalesforceChatterFeedConfiguration (Prelude.Maybe Prelude.Text)
salesforceChatterFeedConfiguration_documentTitleFieldName :: Lens' SalesforceChatterFeedConfiguration (Maybe Text)
salesforceChatterFeedConfiguration_documentTitleFieldName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SalesforceChatterFeedConfiguration' {Maybe Text
documentTitleFieldName :: Maybe Text
$sel:documentTitleFieldName:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration -> Maybe Text
documentTitleFieldName} -> Maybe Text
documentTitleFieldName) (\s :: SalesforceChatterFeedConfiguration
s@SalesforceChatterFeedConfiguration' {} Maybe Text
a -> SalesforceChatterFeedConfiguration
s {$sel:documentTitleFieldName:SalesforceChatterFeedConfiguration' :: Maybe Text
documentTitleFieldName = Maybe Text
a} :: SalesforceChatterFeedConfiguration)

-- | Maps fields from a Salesforce chatter feed into Amazon Kendra index
-- fields.
salesforceChatterFeedConfiguration_fieldMappings :: Lens.Lens' SalesforceChatterFeedConfiguration (Prelude.Maybe (Prelude.NonEmpty DataSourceToIndexFieldMapping))
salesforceChatterFeedConfiguration_fieldMappings :: Lens'
  SalesforceChatterFeedConfiguration
  (Maybe (NonEmpty DataSourceToIndexFieldMapping))
salesforceChatterFeedConfiguration_fieldMappings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SalesforceChatterFeedConfiguration' {Maybe (NonEmpty DataSourceToIndexFieldMapping)
fieldMappings :: Maybe (NonEmpty DataSourceToIndexFieldMapping)
$sel:fieldMappings:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration
-> Maybe (NonEmpty DataSourceToIndexFieldMapping)
fieldMappings} -> Maybe (NonEmpty DataSourceToIndexFieldMapping)
fieldMappings) (\s :: SalesforceChatterFeedConfiguration
s@SalesforceChatterFeedConfiguration' {} Maybe (NonEmpty DataSourceToIndexFieldMapping)
a -> SalesforceChatterFeedConfiguration
s {$sel:fieldMappings:SalesforceChatterFeedConfiguration' :: Maybe (NonEmpty DataSourceToIndexFieldMapping)
fieldMappings = Maybe (NonEmpty DataSourceToIndexFieldMapping)
a} :: SalesforceChatterFeedConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Filters the documents in the feed based on status of the user. When you
-- specify @ACTIVE_USERS@ only documents from users who have an active
-- account are indexed. When you specify @STANDARD_USER@ only documents for
-- Salesforce standard users are documented. You can specify both.
salesforceChatterFeedConfiguration_includeFilterTypes :: Lens.Lens' SalesforceChatterFeedConfiguration (Prelude.Maybe (Prelude.NonEmpty SalesforceChatterFeedIncludeFilterType))
salesforceChatterFeedConfiguration_includeFilterTypes :: Lens'
  SalesforceChatterFeedConfiguration
  (Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType))
salesforceChatterFeedConfiguration_includeFilterTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SalesforceChatterFeedConfiguration' {Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
includeFilterTypes :: Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
$sel:includeFilterTypes:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration
-> Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
includeFilterTypes} -> Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
includeFilterTypes) (\s :: SalesforceChatterFeedConfiguration
s@SalesforceChatterFeedConfiguration' {} Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
a -> SalesforceChatterFeedConfiguration
s {$sel:includeFilterTypes:SalesforceChatterFeedConfiguration' :: Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
includeFilterTypes = Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
a} :: SalesforceChatterFeedConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the column in the Salesforce FeedItem table that contains
-- the content to index. Typically this is the @Body@ column.
salesforceChatterFeedConfiguration_documentDataFieldName :: Lens.Lens' SalesforceChatterFeedConfiguration Prelude.Text
salesforceChatterFeedConfiguration_documentDataFieldName :: Lens' SalesforceChatterFeedConfiguration Text
salesforceChatterFeedConfiguration_documentDataFieldName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SalesforceChatterFeedConfiguration' {Text
documentDataFieldName :: Text
$sel:documentDataFieldName:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration -> Text
documentDataFieldName} -> Text
documentDataFieldName) (\s :: SalesforceChatterFeedConfiguration
s@SalesforceChatterFeedConfiguration' {} Text
a -> SalesforceChatterFeedConfiguration
s {$sel:documentDataFieldName:SalesforceChatterFeedConfiguration' :: Text
documentDataFieldName = Text
a} :: SalesforceChatterFeedConfiguration)

instance
  Data.FromJSON
    SalesforceChatterFeedConfiguration
  where
  parseJSON :: Value -> Parser SalesforceChatterFeedConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SalesforceChatterFeedConfiguration"
      ( \Object
x ->
          Maybe Text
-> Maybe (NonEmpty DataSourceToIndexFieldMapping)
-> Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
-> Text
-> SalesforceChatterFeedConfiguration
SalesforceChatterFeedConfiguration'
            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
"DocumentTitleFieldName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FieldMappings")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IncludeFilterTypes")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DocumentDataFieldName")
      )

instance
  Prelude.Hashable
    SalesforceChatterFeedConfiguration
  where
  hashWithSalt :: Int -> SalesforceChatterFeedConfiguration -> Int
hashWithSalt
    Int
_salt
    SalesforceChatterFeedConfiguration' {Maybe (NonEmpty DataSourceToIndexFieldMapping)
Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
Maybe Text
Text
documentDataFieldName :: Text
includeFilterTypes :: Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
fieldMappings :: Maybe (NonEmpty DataSourceToIndexFieldMapping)
documentTitleFieldName :: Maybe Text
$sel:documentDataFieldName:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration -> Text
$sel:includeFilterTypes:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration
-> Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
$sel:fieldMappings:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration
-> Maybe (NonEmpty DataSourceToIndexFieldMapping)
$sel:documentTitleFieldName:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
documentTitleFieldName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty DataSourceToIndexFieldMapping)
fieldMappings
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
includeFilterTypes
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
documentDataFieldName

instance
  Prelude.NFData
    SalesforceChatterFeedConfiguration
  where
  rnf :: SalesforceChatterFeedConfiguration -> ()
rnf SalesforceChatterFeedConfiguration' {Maybe (NonEmpty DataSourceToIndexFieldMapping)
Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
Maybe Text
Text
documentDataFieldName :: Text
includeFilterTypes :: Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
fieldMappings :: Maybe (NonEmpty DataSourceToIndexFieldMapping)
documentTitleFieldName :: Maybe Text
$sel:documentDataFieldName:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration -> Text
$sel:includeFilterTypes:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration
-> Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
$sel:fieldMappings:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration
-> Maybe (NonEmpty DataSourceToIndexFieldMapping)
$sel:documentTitleFieldName:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
documentTitleFieldName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty DataSourceToIndexFieldMapping)
fieldMappings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
includeFilterTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
documentDataFieldName

instance
  Data.ToJSON
    SalesforceChatterFeedConfiguration
  where
  toJSON :: SalesforceChatterFeedConfiguration -> Value
toJSON SalesforceChatterFeedConfiguration' {Maybe (NonEmpty DataSourceToIndexFieldMapping)
Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
Maybe Text
Text
documentDataFieldName :: Text
includeFilterTypes :: Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
fieldMappings :: Maybe (NonEmpty DataSourceToIndexFieldMapping)
documentTitleFieldName :: Maybe Text
$sel:documentDataFieldName:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration -> Text
$sel:includeFilterTypes:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration
-> Maybe (NonEmpty SalesforceChatterFeedIncludeFilterType)
$sel:fieldMappings:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration
-> Maybe (NonEmpty DataSourceToIndexFieldMapping)
$sel:documentTitleFieldName:SalesforceChatterFeedConfiguration' :: SalesforceChatterFeedConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DocumentTitleFieldName" 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
documentTitleFieldName,
            (Key
"FieldMappings" 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 (NonEmpty DataSourceToIndexFieldMapping)
fieldMappings,
            (Key
"IncludeFilterTypes" 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 (NonEmpty SalesforceChatterFeedIncludeFilterType)
includeFilterTypes,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"DocumentDataFieldName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
documentDataFieldName
              )
          ]
      )