{-# 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.AppFlow.Types.VeevaSourceProperties
-- 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.AppFlow.Types.VeevaSourceProperties 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

-- | The properties that are applied when using Veeva as a flow source.
--
-- /See:/ 'newVeevaSourceProperties' smart constructor.
data VeevaSourceProperties = VeevaSourceProperties'
  { -- | The document type specified in the Veeva document extract flow.
    VeevaSourceProperties -> Maybe Text
documentType :: Prelude.Maybe Prelude.Text,
    -- | Boolean value to include All Versions of files in Veeva document extract
    -- flow.
    VeevaSourceProperties -> Maybe Bool
includeAllVersions :: Prelude.Maybe Prelude.Bool,
    -- | Boolean value to include file renditions in Veeva document extract flow.
    VeevaSourceProperties -> Maybe Bool
includeRenditions :: Prelude.Maybe Prelude.Bool,
    -- | Boolean value to include source files in Veeva document extract flow.
    VeevaSourceProperties -> Maybe Bool
includeSourceFiles :: Prelude.Maybe Prelude.Bool,
    -- | The object specified in the Veeva flow source.
    VeevaSourceProperties -> Text
object' :: Prelude.Text
  }
  deriving (VeevaSourceProperties -> VeevaSourceProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VeevaSourceProperties -> VeevaSourceProperties -> Bool
$c/= :: VeevaSourceProperties -> VeevaSourceProperties -> Bool
== :: VeevaSourceProperties -> VeevaSourceProperties -> Bool
$c== :: VeevaSourceProperties -> VeevaSourceProperties -> Bool
Prelude.Eq, ReadPrec [VeevaSourceProperties]
ReadPrec VeevaSourceProperties
Int -> ReadS VeevaSourceProperties
ReadS [VeevaSourceProperties]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VeevaSourceProperties]
$creadListPrec :: ReadPrec [VeevaSourceProperties]
readPrec :: ReadPrec VeevaSourceProperties
$creadPrec :: ReadPrec VeevaSourceProperties
readList :: ReadS [VeevaSourceProperties]
$creadList :: ReadS [VeevaSourceProperties]
readsPrec :: Int -> ReadS VeevaSourceProperties
$creadsPrec :: Int -> ReadS VeevaSourceProperties
Prelude.Read, Int -> VeevaSourceProperties -> ShowS
[VeevaSourceProperties] -> ShowS
VeevaSourceProperties -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VeevaSourceProperties] -> ShowS
$cshowList :: [VeevaSourceProperties] -> ShowS
show :: VeevaSourceProperties -> String
$cshow :: VeevaSourceProperties -> String
showsPrec :: Int -> VeevaSourceProperties -> ShowS
$cshowsPrec :: Int -> VeevaSourceProperties -> ShowS
Prelude.Show, forall x. Rep VeevaSourceProperties x -> VeevaSourceProperties
forall x. VeevaSourceProperties -> Rep VeevaSourceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VeevaSourceProperties x -> VeevaSourceProperties
$cfrom :: forall x. VeevaSourceProperties -> Rep VeevaSourceProperties x
Prelude.Generic)

-- |
-- Create a value of 'VeevaSourceProperties' 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:
--
-- 'documentType', 'veevaSourceProperties_documentType' - The document type specified in the Veeva document extract flow.
--
-- 'includeAllVersions', 'veevaSourceProperties_includeAllVersions' - Boolean value to include All Versions of files in Veeva document extract
-- flow.
--
-- 'includeRenditions', 'veevaSourceProperties_includeRenditions' - Boolean value to include file renditions in Veeva document extract flow.
--
-- 'includeSourceFiles', 'veevaSourceProperties_includeSourceFiles' - Boolean value to include source files in Veeva document extract flow.
--
-- 'object'', 'veevaSourceProperties_object' - The object specified in the Veeva flow source.
newVeevaSourceProperties ::
  -- | 'object''
  Prelude.Text ->
  VeevaSourceProperties
newVeevaSourceProperties :: Text -> VeevaSourceProperties
newVeevaSourceProperties Text
pObject_ =
  VeevaSourceProperties'
    { $sel:documentType:VeevaSourceProperties' :: Maybe Text
documentType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:includeAllVersions:VeevaSourceProperties' :: Maybe Bool
includeAllVersions = forall a. Maybe a
Prelude.Nothing,
      $sel:includeRenditions:VeevaSourceProperties' :: Maybe Bool
includeRenditions = forall a. Maybe a
Prelude.Nothing,
      $sel:includeSourceFiles:VeevaSourceProperties' :: Maybe Bool
includeSourceFiles = forall a. Maybe a
Prelude.Nothing,
      $sel:object':VeevaSourceProperties' :: Text
object' = Text
pObject_
    }

-- | The document type specified in the Veeva document extract flow.
veevaSourceProperties_documentType :: Lens.Lens' VeevaSourceProperties (Prelude.Maybe Prelude.Text)
veevaSourceProperties_documentType :: Lens' VeevaSourceProperties (Maybe Text)
veevaSourceProperties_documentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VeevaSourceProperties' {Maybe Text
documentType :: Maybe Text
$sel:documentType:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Text
documentType} -> Maybe Text
documentType) (\s :: VeevaSourceProperties
s@VeevaSourceProperties' {} Maybe Text
a -> VeevaSourceProperties
s {$sel:documentType:VeevaSourceProperties' :: Maybe Text
documentType = Maybe Text
a} :: VeevaSourceProperties)

-- | Boolean value to include All Versions of files in Veeva document extract
-- flow.
veevaSourceProperties_includeAllVersions :: Lens.Lens' VeevaSourceProperties (Prelude.Maybe Prelude.Bool)
veevaSourceProperties_includeAllVersions :: Lens' VeevaSourceProperties (Maybe Bool)
veevaSourceProperties_includeAllVersions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VeevaSourceProperties' {Maybe Bool
includeAllVersions :: Maybe Bool
$sel:includeAllVersions:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
includeAllVersions} -> Maybe Bool
includeAllVersions) (\s :: VeevaSourceProperties
s@VeevaSourceProperties' {} Maybe Bool
a -> VeevaSourceProperties
s {$sel:includeAllVersions:VeevaSourceProperties' :: Maybe Bool
includeAllVersions = Maybe Bool
a} :: VeevaSourceProperties)

-- | Boolean value to include file renditions in Veeva document extract flow.
veevaSourceProperties_includeRenditions :: Lens.Lens' VeevaSourceProperties (Prelude.Maybe Prelude.Bool)
veevaSourceProperties_includeRenditions :: Lens' VeevaSourceProperties (Maybe Bool)
veevaSourceProperties_includeRenditions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VeevaSourceProperties' {Maybe Bool
includeRenditions :: Maybe Bool
$sel:includeRenditions:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
includeRenditions} -> Maybe Bool
includeRenditions) (\s :: VeevaSourceProperties
s@VeevaSourceProperties' {} Maybe Bool
a -> VeevaSourceProperties
s {$sel:includeRenditions:VeevaSourceProperties' :: Maybe Bool
includeRenditions = Maybe Bool
a} :: VeevaSourceProperties)

-- | Boolean value to include source files in Veeva document extract flow.
veevaSourceProperties_includeSourceFiles :: Lens.Lens' VeevaSourceProperties (Prelude.Maybe Prelude.Bool)
veevaSourceProperties_includeSourceFiles :: Lens' VeevaSourceProperties (Maybe Bool)
veevaSourceProperties_includeSourceFiles = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VeevaSourceProperties' {Maybe Bool
includeSourceFiles :: Maybe Bool
$sel:includeSourceFiles:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
includeSourceFiles} -> Maybe Bool
includeSourceFiles) (\s :: VeevaSourceProperties
s@VeevaSourceProperties' {} Maybe Bool
a -> VeevaSourceProperties
s {$sel:includeSourceFiles:VeevaSourceProperties' :: Maybe Bool
includeSourceFiles = Maybe Bool
a} :: VeevaSourceProperties)

-- | The object specified in the Veeva flow source.
veevaSourceProperties_object :: Lens.Lens' VeevaSourceProperties Prelude.Text
veevaSourceProperties_object :: Lens' VeevaSourceProperties Text
veevaSourceProperties_object = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VeevaSourceProperties' {Text
object' :: Text
$sel:object':VeevaSourceProperties' :: VeevaSourceProperties -> Text
object'} -> Text
object') (\s :: VeevaSourceProperties
s@VeevaSourceProperties' {} Text
a -> VeevaSourceProperties
s {$sel:object':VeevaSourceProperties' :: Text
object' = Text
a} :: VeevaSourceProperties)

instance Data.FromJSON VeevaSourceProperties where
  parseJSON :: Value -> Parser VeevaSourceProperties
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VeevaSourceProperties"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Text
-> VeevaSourceProperties
VeevaSourceProperties'
            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
"documentType")
            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
"includeAllVersions")
            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
"includeRenditions")
            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
"includeSourceFiles")
            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
"object")
      )

instance Prelude.Hashable VeevaSourceProperties where
  hashWithSalt :: Int -> VeevaSourceProperties -> Int
hashWithSalt Int
_salt VeevaSourceProperties' {Maybe Bool
Maybe Text
Text
object' :: Text
includeSourceFiles :: Maybe Bool
includeRenditions :: Maybe Bool
includeAllVersions :: Maybe Bool
documentType :: Maybe Text
$sel:object':VeevaSourceProperties' :: VeevaSourceProperties -> Text
$sel:includeSourceFiles:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
$sel:includeRenditions:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
$sel:includeAllVersions:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
$sel:documentType:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
documentType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
includeAllVersions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
includeRenditions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
includeSourceFiles
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
object'

instance Prelude.NFData VeevaSourceProperties where
  rnf :: VeevaSourceProperties -> ()
rnf VeevaSourceProperties' {Maybe Bool
Maybe Text
Text
object' :: Text
includeSourceFiles :: Maybe Bool
includeRenditions :: Maybe Bool
includeAllVersions :: Maybe Bool
documentType :: Maybe Text
$sel:object':VeevaSourceProperties' :: VeevaSourceProperties -> Text
$sel:includeSourceFiles:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
$sel:includeRenditions:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
$sel:includeAllVersions:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
$sel:documentType:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
documentType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
includeAllVersions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
includeRenditions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
includeSourceFiles
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
object'

instance Data.ToJSON VeevaSourceProperties where
  toJSON :: VeevaSourceProperties -> Value
toJSON VeevaSourceProperties' {Maybe Bool
Maybe Text
Text
object' :: Text
includeSourceFiles :: Maybe Bool
includeRenditions :: Maybe Bool
includeAllVersions :: Maybe Bool
documentType :: Maybe Text
$sel:object':VeevaSourceProperties' :: VeevaSourceProperties -> Text
$sel:includeSourceFiles:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
$sel:includeRenditions:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
$sel:includeAllVersions:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Bool
$sel:documentType:VeevaSourceProperties' :: VeevaSourceProperties -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"documentType" 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
documentType,
            (Key
"includeAllVersions" 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 Bool
includeAllVersions,
            (Key
"includeRenditions" 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 Bool
includeRenditions,
            (Key
"includeSourceFiles" 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 Bool
includeSourceFiles,
            forall a. a -> Maybe a
Prelude.Just (Key
"object" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
object')
          ]
      )