{-# 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.AppIntegrationS.Types.ScheduleConfiguration
-- 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.AppIntegrationS.Types.ScheduleConfiguration 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 name of the data and how often it should be pulled from the source.
--
-- /See:/ 'newScheduleConfiguration' smart constructor.
data ScheduleConfiguration = ScheduleConfiguration'
  { -- | The start date for objects to import in the first flow run.
    ScheduleConfiguration -> Maybe Text
firstExecutionFrom :: Prelude.Maybe Prelude.Text,
    -- | The name of the object to pull from the data source.
    ScheduleConfiguration -> Maybe Text
object' :: Prelude.Maybe Prelude.Text,
    -- | How often the data should be pulled from data source.
    ScheduleConfiguration -> Maybe Text
scheduleExpression :: Prelude.Maybe Prelude.Text
  }
  deriving (ScheduleConfiguration -> ScheduleConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduleConfiguration -> ScheduleConfiguration -> Bool
$c/= :: ScheduleConfiguration -> ScheduleConfiguration -> Bool
== :: ScheduleConfiguration -> ScheduleConfiguration -> Bool
$c== :: ScheduleConfiguration -> ScheduleConfiguration -> Bool
Prelude.Eq, ReadPrec [ScheduleConfiguration]
ReadPrec ScheduleConfiguration
Int -> ReadS ScheduleConfiguration
ReadS [ScheduleConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduleConfiguration]
$creadListPrec :: ReadPrec [ScheduleConfiguration]
readPrec :: ReadPrec ScheduleConfiguration
$creadPrec :: ReadPrec ScheduleConfiguration
readList :: ReadS [ScheduleConfiguration]
$creadList :: ReadS [ScheduleConfiguration]
readsPrec :: Int -> ReadS ScheduleConfiguration
$creadsPrec :: Int -> ReadS ScheduleConfiguration
Prelude.Read, Int -> ScheduleConfiguration -> ShowS
[ScheduleConfiguration] -> ShowS
ScheduleConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduleConfiguration] -> ShowS
$cshowList :: [ScheduleConfiguration] -> ShowS
show :: ScheduleConfiguration -> String
$cshow :: ScheduleConfiguration -> String
showsPrec :: Int -> ScheduleConfiguration -> ShowS
$cshowsPrec :: Int -> ScheduleConfiguration -> ShowS
Prelude.Show, forall x. Rep ScheduleConfiguration x -> ScheduleConfiguration
forall x. ScheduleConfiguration -> Rep ScheduleConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScheduleConfiguration x -> ScheduleConfiguration
$cfrom :: forall x. ScheduleConfiguration -> Rep ScheduleConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ScheduleConfiguration' 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:
--
-- 'firstExecutionFrom', 'scheduleConfiguration_firstExecutionFrom' - The start date for objects to import in the first flow run.
--
-- 'object'', 'scheduleConfiguration_object' - The name of the object to pull from the data source.
--
-- 'scheduleExpression', 'scheduleConfiguration_scheduleExpression' - How often the data should be pulled from data source.
newScheduleConfiguration ::
  ScheduleConfiguration
newScheduleConfiguration :: ScheduleConfiguration
newScheduleConfiguration =
  ScheduleConfiguration'
    { $sel:firstExecutionFrom:ScheduleConfiguration' :: Maybe Text
firstExecutionFrom =
        forall a. Maybe a
Prelude.Nothing,
      $sel:object':ScheduleConfiguration' :: Maybe Text
object' = forall a. Maybe a
Prelude.Nothing,
      $sel:scheduleExpression:ScheduleConfiguration' :: Maybe Text
scheduleExpression = forall a. Maybe a
Prelude.Nothing
    }

-- | The start date for objects to import in the first flow run.
scheduleConfiguration_firstExecutionFrom :: Lens.Lens' ScheduleConfiguration (Prelude.Maybe Prelude.Text)
scheduleConfiguration_firstExecutionFrom :: Lens' ScheduleConfiguration (Maybe Text)
scheduleConfiguration_firstExecutionFrom = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleConfiguration' {Maybe Text
firstExecutionFrom :: Maybe Text
$sel:firstExecutionFrom:ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
firstExecutionFrom} -> Maybe Text
firstExecutionFrom) (\s :: ScheduleConfiguration
s@ScheduleConfiguration' {} Maybe Text
a -> ScheduleConfiguration
s {$sel:firstExecutionFrom:ScheduleConfiguration' :: Maybe Text
firstExecutionFrom = Maybe Text
a} :: ScheduleConfiguration)

-- | The name of the object to pull from the data source.
scheduleConfiguration_object :: Lens.Lens' ScheduleConfiguration (Prelude.Maybe Prelude.Text)
scheduleConfiguration_object :: Lens' ScheduleConfiguration (Maybe Text)
scheduleConfiguration_object = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleConfiguration' {Maybe Text
object' :: Maybe Text
$sel:object':ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
object'} -> Maybe Text
object') (\s :: ScheduleConfiguration
s@ScheduleConfiguration' {} Maybe Text
a -> ScheduleConfiguration
s {$sel:object':ScheduleConfiguration' :: Maybe Text
object' = Maybe Text
a} :: ScheduleConfiguration)

-- | How often the data should be pulled from data source.
scheduleConfiguration_scheduleExpression :: Lens.Lens' ScheduleConfiguration (Prelude.Maybe Prelude.Text)
scheduleConfiguration_scheduleExpression :: Lens' ScheduleConfiguration (Maybe Text)
scheduleConfiguration_scheduleExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleConfiguration' {Maybe Text
scheduleExpression :: Maybe Text
$sel:scheduleExpression:ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
scheduleExpression} -> Maybe Text
scheduleExpression) (\s :: ScheduleConfiguration
s@ScheduleConfiguration' {} Maybe Text
a -> ScheduleConfiguration
s {$sel:scheduleExpression:ScheduleConfiguration' :: Maybe Text
scheduleExpression = Maybe Text
a} :: ScheduleConfiguration)

instance Data.FromJSON ScheduleConfiguration where
  parseJSON :: Value -> Parser ScheduleConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScheduleConfiguration"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> ScheduleConfiguration
ScheduleConfiguration'
            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
"FirstExecutionFrom")
            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
"Object")
            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
"ScheduleExpression")
      )

instance Prelude.Hashable ScheduleConfiguration where
  hashWithSalt :: Int -> ScheduleConfiguration -> Int
hashWithSalt Int
_salt ScheduleConfiguration' {Maybe Text
scheduleExpression :: Maybe Text
object' :: Maybe Text
firstExecutionFrom :: Maybe Text
$sel:scheduleExpression:ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
$sel:object':ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
$sel:firstExecutionFrom:ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
firstExecutionFrom
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
object'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
scheduleExpression

instance Prelude.NFData ScheduleConfiguration where
  rnf :: ScheduleConfiguration -> ()
rnf ScheduleConfiguration' {Maybe Text
scheduleExpression :: Maybe Text
object' :: Maybe Text
firstExecutionFrom :: Maybe Text
$sel:scheduleExpression:ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
$sel:object':ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
$sel:firstExecutionFrom:ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
firstExecutionFrom
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
object'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
scheduleExpression

instance Data.ToJSON ScheduleConfiguration where
  toJSON :: ScheduleConfiguration -> Value
toJSON ScheduleConfiguration' {Maybe Text
scheduleExpression :: Maybe Text
object' :: Maybe Text
firstExecutionFrom :: Maybe Text
$sel:scheduleExpression:ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
$sel:object':ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
$sel:firstExecutionFrom:ScheduleConfiguration' :: ScheduleConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"FirstExecutionFrom" 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
firstExecutionFrom,
            (Key
"Object" 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
object',
            (Key
"ScheduleExpression" 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
scheduleExpression
          ]
      )