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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | Boolean value to include All Versions of files in Veeva document extract
    -- flow.
    VeevaSourceProperties -> Maybe Bool
includeAllVersions :: Prelude.Maybe Prelude.Bool,
    -- | The document type specified in the Veeva document extract flow.
    VeevaSourceProperties -> Maybe Text
documentType :: Prelude.Maybe Prelude.Text,
    -- | 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
(VeevaSourceProperties -> VeevaSourceProperties -> Bool)
-> (VeevaSourceProperties -> VeevaSourceProperties -> Bool)
-> Eq VeevaSourceProperties
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]
(Int -> ReadS VeevaSourceProperties)
-> ReadS [VeevaSourceProperties]
-> ReadPrec VeevaSourceProperties
-> ReadPrec [VeevaSourceProperties]
-> Read 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
(Int -> VeevaSourceProperties -> ShowS)
-> (VeevaSourceProperties -> String)
-> ([VeevaSourceProperties] -> ShowS)
-> Show VeevaSourceProperties
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. VeevaSourceProperties -> Rep VeevaSourceProperties x)
-> (forall x. Rep VeevaSourceProperties x -> VeevaSourceProperties)
-> Generic VeevaSourceProperties
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:
--
-- 'includeAllVersions', 'veevaSourceProperties_includeAllVersions' - Boolean value to include All Versions of files in Veeva document extract
-- flow.
--
-- 'documentType', 'veevaSourceProperties_documentType' - The document type specified in the 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' :: Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Text
-> VeevaSourceProperties
VeevaSourceProperties'
    { $sel:includeAllVersions:VeevaSourceProperties' :: Maybe Bool
includeAllVersions =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:documentType:VeevaSourceProperties' :: Maybe Text
documentType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:includeRenditions:VeevaSourceProperties' :: Maybe Bool
includeRenditions = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:includeSourceFiles:VeevaSourceProperties' :: Maybe Bool
includeSourceFiles = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:object':VeevaSourceProperties' :: Text
object' = Text
pObject_
    }

-- | Boolean value to include All Versions of files in Veeva document extract
-- flow.
veevaSourceProperties_includeAllVersions :: Lens.Lens' VeevaSourceProperties (Prelude.Maybe Prelude.Bool)
veevaSourceProperties_includeAllVersions :: (Maybe Bool -> f (Maybe Bool))
-> VeevaSourceProperties -> f VeevaSourceProperties
veevaSourceProperties_includeAllVersions = (VeevaSourceProperties -> Maybe Bool)
-> (VeevaSourceProperties -> Maybe Bool -> VeevaSourceProperties)
-> Lens
     VeevaSourceProperties
     VeevaSourceProperties
     (Maybe Bool)
     (Maybe Bool)
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)

-- | The document type specified in the Veeva document extract flow.
veevaSourceProperties_documentType :: Lens.Lens' VeevaSourceProperties (Prelude.Maybe Prelude.Text)
veevaSourceProperties_documentType :: (Maybe Text -> f (Maybe Text))
-> VeevaSourceProperties -> f VeevaSourceProperties
veevaSourceProperties_documentType = (VeevaSourceProperties -> Maybe Text)
-> (VeevaSourceProperties -> Maybe Text -> VeevaSourceProperties)
-> Lens
     VeevaSourceProperties
     VeevaSourceProperties
     (Maybe Text)
     (Maybe Text)
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 file renditions in Veeva document extract flow.
veevaSourceProperties_includeRenditions :: Lens.Lens' VeevaSourceProperties (Prelude.Maybe Prelude.Bool)
veevaSourceProperties_includeRenditions :: (Maybe Bool -> f (Maybe Bool))
-> VeevaSourceProperties -> f VeevaSourceProperties
veevaSourceProperties_includeRenditions = (VeevaSourceProperties -> Maybe Bool)
-> (VeevaSourceProperties -> Maybe Bool -> VeevaSourceProperties)
-> Lens
     VeevaSourceProperties
     VeevaSourceProperties
     (Maybe Bool)
     (Maybe Bool)
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 :: (Maybe Bool -> f (Maybe Bool))
-> VeevaSourceProperties -> f VeevaSourceProperties
veevaSourceProperties_includeSourceFiles = (VeevaSourceProperties -> Maybe Bool)
-> (VeevaSourceProperties -> Maybe Bool -> VeevaSourceProperties)
-> Lens
     VeevaSourceProperties
     VeevaSourceProperties
     (Maybe Bool)
     (Maybe Bool)
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 :: (Text -> f Text)
-> VeevaSourceProperties -> f VeevaSourceProperties
veevaSourceProperties_object = (VeevaSourceProperties -> Text)
-> (VeevaSourceProperties -> Text -> VeevaSourceProperties)
-> Lens VeevaSourceProperties VeevaSourceProperties Text Text
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 Core.FromJSON VeevaSourceProperties where
  parseJSON :: Value -> Parser VeevaSourceProperties
parseJSON =
    String
-> (Object -> Parser VeevaSourceProperties)
-> Value
-> Parser VeevaSourceProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VeevaSourceProperties"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Text
-> VeevaSourceProperties
VeevaSourceProperties'
            (Maybe Bool
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Bool
 -> Text
 -> VeevaSourceProperties)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Bool -> Maybe Bool -> Text -> VeevaSourceProperties)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"includeAllVersions")
            Parser
  (Maybe Text
   -> Maybe Bool -> Maybe Bool -> Text -> VeevaSourceProperties)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Maybe Bool -> Text -> VeevaSourceProperties)
forall (f :: * -> *) a b. Applicative f => 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
"documentType")
            Parser (Maybe Bool -> Maybe Bool -> Text -> VeevaSourceProperties)
-> Parser (Maybe Bool)
-> Parser (Maybe Bool -> Text -> VeevaSourceProperties)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"includeRenditions")
            Parser (Maybe Bool -> Text -> VeevaSourceProperties)
-> Parser (Maybe Bool) -> Parser (Text -> VeevaSourceProperties)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"includeSourceFiles")
            Parser (Text -> VeevaSourceProperties)
-> Parser Text -> Parser VeevaSourceProperties
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"object")
      )

instance Prelude.Hashable VeevaSourceProperties

instance Prelude.NFData VeevaSourceProperties

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