{-# 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.CustomerProfiles.Types.AppflowIntegration
-- 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.CustomerProfiles.Types.AppflowIntegration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.CustomerProfiles.Types.Batch
import Amazonka.CustomerProfiles.Types.FlowDefinition
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Details for workflow of type @APPFLOW_INTEGRATION@.
--
-- /See:/ 'newAppflowIntegration' smart constructor.
data AppflowIntegration = AppflowIntegration'
  { -- | Batches in workflow of type @APPFLOW_INTEGRATION@.
    AppflowIntegration -> Maybe [Batch]
batches :: Prelude.Maybe [Batch],
    AppflowIntegration -> FlowDefinition
flowDefinition :: FlowDefinition
  }
  deriving (AppflowIntegration -> AppflowIntegration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppflowIntegration -> AppflowIntegration -> Bool
$c/= :: AppflowIntegration -> AppflowIntegration -> Bool
== :: AppflowIntegration -> AppflowIntegration -> Bool
$c== :: AppflowIntegration -> AppflowIntegration -> Bool
Prelude.Eq, ReadPrec [AppflowIntegration]
ReadPrec AppflowIntegration
Int -> ReadS AppflowIntegration
ReadS [AppflowIntegration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AppflowIntegration]
$creadListPrec :: ReadPrec [AppflowIntegration]
readPrec :: ReadPrec AppflowIntegration
$creadPrec :: ReadPrec AppflowIntegration
readList :: ReadS [AppflowIntegration]
$creadList :: ReadS [AppflowIntegration]
readsPrec :: Int -> ReadS AppflowIntegration
$creadsPrec :: Int -> ReadS AppflowIntegration
Prelude.Read, Int -> AppflowIntegration -> ShowS
[AppflowIntegration] -> ShowS
AppflowIntegration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppflowIntegration] -> ShowS
$cshowList :: [AppflowIntegration] -> ShowS
show :: AppflowIntegration -> String
$cshow :: AppflowIntegration -> String
showsPrec :: Int -> AppflowIntegration -> ShowS
$cshowsPrec :: Int -> AppflowIntegration -> ShowS
Prelude.Show, forall x. Rep AppflowIntegration x -> AppflowIntegration
forall x. AppflowIntegration -> Rep AppflowIntegration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AppflowIntegration x -> AppflowIntegration
$cfrom :: forall x. AppflowIntegration -> Rep AppflowIntegration x
Prelude.Generic)

-- |
-- Create a value of 'AppflowIntegration' 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:
--
-- 'batches', 'appflowIntegration_batches' - Batches in workflow of type @APPFLOW_INTEGRATION@.
--
-- 'flowDefinition', 'appflowIntegration_flowDefinition' - Undocumented member.
newAppflowIntegration ::
  -- | 'flowDefinition'
  FlowDefinition ->
  AppflowIntegration
newAppflowIntegration :: FlowDefinition -> AppflowIntegration
newAppflowIntegration FlowDefinition
pFlowDefinition_ =
  AppflowIntegration'
    { $sel:batches:AppflowIntegration' :: Maybe [Batch]
batches = forall a. Maybe a
Prelude.Nothing,
      $sel:flowDefinition:AppflowIntegration' :: FlowDefinition
flowDefinition = FlowDefinition
pFlowDefinition_
    }

-- | Batches in workflow of type @APPFLOW_INTEGRATION@.
appflowIntegration_batches :: Lens.Lens' AppflowIntegration (Prelude.Maybe [Batch])
appflowIntegration_batches :: Lens' AppflowIntegration (Maybe [Batch])
appflowIntegration_batches = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppflowIntegration' {Maybe [Batch]
batches :: Maybe [Batch]
$sel:batches:AppflowIntegration' :: AppflowIntegration -> Maybe [Batch]
batches} -> Maybe [Batch]
batches) (\s :: AppflowIntegration
s@AppflowIntegration' {} Maybe [Batch]
a -> AppflowIntegration
s {$sel:batches:AppflowIntegration' :: Maybe [Batch]
batches = Maybe [Batch]
a} :: AppflowIntegration) 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

-- | Undocumented member.
appflowIntegration_flowDefinition :: Lens.Lens' AppflowIntegration FlowDefinition
appflowIntegration_flowDefinition :: Lens' AppflowIntegration FlowDefinition
appflowIntegration_flowDefinition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppflowIntegration' {FlowDefinition
flowDefinition :: FlowDefinition
$sel:flowDefinition:AppflowIntegration' :: AppflowIntegration -> FlowDefinition
flowDefinition} -> FlowDefinition
flowDefinition) (\s :: AppflowIntegration
s@AppflowIntegration' {} FlowDefinition
a -> AppflowIntegration
s {$sel:flowDefinition:AppflowIntegration' :: FlowDefinition
flowDefinition = FlowDefinition
a} :: AppflowIntegration)

instance Prelude.Hashable AppflowIntegration where
  hashWithSalt :: Int -> AppflowIntegration -> Int
hashWithSalt Int
_salt AppflowIntegration' {Maybe [Batch]
FlowDefinition
flowDefinition :: FlowDefinition
batches :: Maybe [Batch]
$sel:flowDefinition:AppflowIntegration' :: AppflowIntegration -> FlowDefinition
$sel:batches:AppflowIntegration' :: AppflowIntegration -> Maybe [Batch]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Batch]
batches
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FlowDefinition
flowDefinition

instance Prelude.NFData AppflowIntegration where
  rnf :: AppflowIntegration -> ()
rnf AppflowIntegration' {Maybe [Batch]
FlowDefinition
flowDefinition :: FlowDefinition
batches :: Maybe [Batch]
$sel:flowDefinition:AppflowIntegration' :: AppflowIntegration -> FlowDefinition
$sel:batches:AppflowIntegration' :: AppflowIntegration -> Maybe [Batch]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Batch]
batches
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FlowDefinition
flowDefinition

instance Data.ToJSON AppflowIntegration where
  toJSON :: AppflowIntegration -> Value
toJSON AppflowIntegration' {Maybe [Batch]
FlowDefinition
flowDefinition :: FlowDefinition
batches :: Maybe [Batch]
$sel:flowDefinition:AppflowIntegration' :: AppflowIntegration -> FlowDefinition
$sel:batches:AppflowIntegration' :: AppflowIntegration -> Maybe [Batch]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Batches" 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 [Batch]
batches,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"FlowDefinition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FlowDefinition
flowDefinition)
          ]
      )