{-# 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.Pinpoint.Types.WriteJourneyRequest
-- 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.Pinpoint.Types.WriteJourneyRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.Activity
import Amazonka.Pinpoint.Types.JourneyLimits
import Amazonka.Pinpoint.Types.JourneySchedule
import Amazonka.Pinpoint.Types.QuietTime
import Amazonka.Pinpoint.Types.StartCondition
import Amazonka.Pinpoint.Types.State
import qualified Amazonka.Prelude as Prelude

-- | Specifies the configuration and other settings for a journey.
--
-- /See:/ 'newWriteJourneyRequest' smart constructor.
data WriteJourneyRequest = WriteJourneyRequest'
  { -- | The status of the journey. Valid values are:
    --
    -- -   DRAFT - Saves the journey and doesn\'t publish it.
    --
    -- -   ACTIVE - Saves and publishes the journey. Depending on the
    --     journey\'s schedule, the journey starts running immediately or at
    --     the scheduled start time. If a journey\'s status is ACTIVE, you
    --     can\'t add, change, or remove activities from it.
    --
    -- PAUSED, CANCELLED, COMPLETED, and CLOSED states are not supported in
    -- requests to create or update a journey. To cancel, pause, or resume a
    -- journey, use the Journey State resource.
    WriteJourneyRequest -> Maybe State
state :: Prelude.Maybe State,
    -- | The date, in ISO 8601 format, when the journey was last modified.
    WriteJourneyRequest -> Maybe Text
lastModifiedDate :: Prelude.Maybe Prelude.Text,
    -- | The schedule settings for the journey.
    WriteJourneyRequest -> Maybe JourneySchedule
schedule :: Prelude.Maybe JourneySchedule,
    -- | Specifies whether the journey\'s scheduled start and end times use each
    -- participant\'s local time. To base the schedule on each participant\'s
    -- local time, set this value to true.
    WriteJourneyRequest -> Maybe Bool
localTime :: Prelude.Maybe Prelude.Bool,
    -- | A map that contains a set of Activity objects, one object for each
    -- activity in the journey. For each Activity object, the key is the unique
    -- identifier (string) for an activity and the value is the settings for
    -- the activity. An activity identifier can contain a maximum of 100
    -- characters. The characters must be alphanumeric characters.
    WriteJourneyRequest -> Maybe (HashMap Text Activity)
activities :: Prelude.Maybe (Prelude.HashMap Prelude.Text Activity),
    -- | Specifies whether a journey should be refreshed on segment update.
    WriteJourneyRequest -> Maybe Bool
refreshOnSegmentUpdate :: Prelude.Maybe Prelude.Bool,
    -- | The messaging and entry limits for the journey.
    WriteJourneyRequest -> Maybe JourneyLimits
limits :: Prelude.Maybe JourneyLimits,
    -- | Specifies whether endpoints in quiet hours should enter a wait till the
    -- end of their quiet hours.
    WriteJourneyRequest -> Maybe Bool
waitForQuietTime :: Prelude.Maybe Prelude.Bool,
    -- | The quiet time settings for the journey. Quiet time is a specific time
    -- range when a journey doesn\'t send messages to participants, if all the
    -- following conditions are met:
    --
    -- -   The EndpointDemographic.Timezone property of the endpoint for the
    --     participant is set to a valid value.
    --
    -- -   The current time in the participant\'s time zone is later than or
    --     equal to the time specified by the QuietTime.Start property for the
    --     journey.
    --
    -- -   The current time in the participant\'s time zone is earlier than or
    --     equal to the time specified by the QuietTime.End property for the
    --     journey.
    --
    -- If any of the preceding conditions isn\'t met, the participant will
    -- receive messages from the journey, even if quiet time is enabled.
    WriteJourneyRequest -> Maybe QuietTime
quietTime :: Prelude.Maybe QuietTime,
    -- | The unique identifier for the first activity in the journey. The
    -- identifier for this activity can contain a maximum of 128 characters.
    -- The characters must be alphanumeric characters.
    WriteJourneyRequest -> Maybe Text
startActivity :: Prelude.Maybe Prelude.Text,
    -- | The date, in ISO 8601 format, when the journey was created.
    WriteJourneyRequest -> Maybe Text
creationDate :: Prelude.Maybe Prelude.Text,
    -- | The segment that defines which users are participants in the journey.
    WriteJourneyRequest -> Maybe StartCondition
startCondition :: Prelude.Maybe StartCondition,
    -- | The frequency with which Amazon Pinpoint evaluates segment and event
    -- data for the journey, as a duration in ISO 8601 format.
    WriteJourneyRequest -> Maybe Text
refreshFrequency :: Prelude.Maybe Prelude.Text,
    -- | The name of the journey. A journey name can contain a maximum of 150
    -- characters. The characters can be alphanumeric characters or symbols,
    -- such as underscores (_) or hyphens (-). A journey name can\'t contain
    -- any spaces.
    WriteJourneyRequest -> Text
name :: Prelude.Text
  }
  deriving (WriteJourneyRequest -> WriteJourneyRequest -> Bool
(WriteJourneyRequest -> WriteJourneyRequest -> Bool)
-> (WriteJourneyRequest -> WriteJourneyRequest -> Bool)
-> Eq WriteJourneyRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WriteJourneyRequest -> WriteJourneyRequest -> Bool
$c/= :: WriteJourneyRequest -> WriteJourneyRequest -> Bool
== :: WriteJourneyRequest -> WriteJourneyRequest -> Bool
$c== :: WriteJourneyRequest -> WriteJourneyRequest -> Bool
Prelude.Eq, ReadPrec [WriteJourneyRequest]
ReadPrec WriteJourneyRequest
Int -> ReadS WriteJourneyRequest
ReadS [WriteJourneyRequest]
(Int -> ReadS WriteJourneyRequest)
-> ReadS [WriteJourneyRequest]
-> ReadPrec WriteJourneyRequest
-> ReadPrec [WriteJourneyRequest]
-> Read WriteJourneyRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WriteJourneyRequest]
$creadListPrec :: ReadPrec [WriteJourneyRequest]
readPrec :: ReadPrec WriteJourneyRequest
$creadPrec :: ReadPrec WriteJourneyRequest
readList :: ReadS [WriteJourneyRequest]
$creadList :: ReadS [WriteJourneyRequest]
readsPrec :: Int -> ReadS WriteJourneyRequest
$creadsPrec :: Int -> ReadS WriteJourneyRequest
Prelude.Read, Int -> WriteJourneyRequest -> ShowS
[WriteJourneyRequest] -> ShowS
WriteJourneyRequest -> String
(Int -> WriteJourneyRequest -> ShowS)
-> (WriteJourneyRequest -> String)
-> ([WriteJourneyRequest] -> ShowS)
-> Show WriteJourneyRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WriteJourneyRequest] -> ShowS
$cshowList :: [WriteJourneyRequest] -> ShowS
show :: WriteJourneyRequest -> String
$cshow :: WriteJourneyRequest -> String
showsPrec :: Int -> WriteJourneyRequest -> ShowS
$cshowsPrec :: Int -> WriteJourneyRequest -> ShowS
Prelude.Show, (forall x. WriteJourneyRequest -> Rep WriteJourneyRequest x)
-> (forall x. Rep WriteJourneyRequest x -> WriteJourneyRequest)
-> Generic WriteJourneyRequest
forall x. Rep WriteJourneyRequest x -> WriteJourneyRequest
forall x. WriteJourneyRequest -> Rep WriteJourneyRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WriteJourneyRequest x -> WriteJourneyRequest
$cfrom :: forall x. WriteJourneyRequest -> Rep WriteJourneyRequest x
Prelude.Generic)

-- |
-- Create a value of 'WriteJourneyRequest' 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:
--
-- 'state', 'writeJourneyRequest_state' - The status of the journey. Valid values are:
--
-- -   DRAFT - Saves the journey and doesn\'t publish it.
--
-- -   ACTIVE - Saves and publishes the journey. Depending on the
--     journey\'s schedule, the journey starts running immediately or at
--     the scheduled start time. If a journey\'s status is ACTIVE, you
--     can\'t add, change, or remove activities from it.
--
-- PAUSED, CANCELLED, COMPLETED, and CLOSED states are not supported in
-- requests to create or update a journey. To cancel, pause, or resume a
-- journey, use the Journey State resource.
--
-- 'lastModifiedDate', 'writeJourneyRequest_lastModifiedDate' - The date, in ISO 8601 format, when the journey was last modified.
--
-- 'schedule', 'writeJourneyRequest_schedule' - The schedule settings for the journey.
--
-- 'localTime', 'writeJourneyRequest_localTime' - Specifies whether the journey\'s scheduled start and end times use each
-- participant\'s local time. To base the schedule on each participant\'s
-- local time, set this value to true.
--
-- 'activities', 'writeJourneyRequest_activities' - A map that contains a set of Activity objects, one object for each
-- activity in the journey. For each Activity object, the key is the unique
-- identifier (string) for an activity and the value is the settings for
-- the activity. An activity identifier can contain a maximum of 100
-- characters. The characters must be alphanumeric characters.
--
-- 'refreshOnSegmentUpdate', 'writeJourneyRequest_refreshOnSegmentUpdate' - Specifies whether a journey should be refreshed on segment update.
--
-- 'limits', 'writeJourneyRequest_limits' - The messaging and entry limits for the journey.
--
-- 'waitForQuietTime', 'writeJourneyRequest_waitForQuietTime' - Specifies whether endpoints in quiet hours should enter a wait till the
-- end of their quiet hours.
--
-- 'quietTime', 'writeJourneyRequest_quietTime' - The quiet time settings for the journey. Quiet time is a specific time
-- range when a journey doesn\'t send messages to participants, if all the
-- following conditions are met:
--
-- -   The EndpointDemographic.Timezone property of the endpoint for the
--     participant is set to a valid value.
--
-- -   The current time in the participant\'s time zone is later than or
--     equal to the time specified by the QuietTime.Start property for the
--     journey.
--
-- -   The current time in the participant\'s time zone is earlier than or
--     equal to the time specified by the QuietTime.End property for the
--     journey.
--
-- If any of the preceding conditions isn\'t met, the participant will
-- receive messages from the journey, even if quiet time is enabled.
--
-- 'startActivity', 'writeJourneyRequest_startActivity' - The unique identifier for the first activity in the journey. The
-- identifier for this activity can contain a maximum of 128 characters.
-- The characters must be alphanumeric characters.
--
-- 'creationDate', 'writeJourneyRequest_creationDate' - The date, in ISO 8601 format, when the journey was created.
--
-- 'startCondition', 'writeJourneyRequest_startCondition' - The segment that defines which users are participants in the journey.
--
-- 'refreshFrequency', 'writeJourneyRequest_refreshFrequency' - The frequency with which Amazon Pinpoint evaluates segment and event
-- data for the journey, as a duration in ISO 8601 format.
--
-- 'name', 'writeJourneyRequest_name' - The name of the journey. A journey name can contain a maximum of 150
-- characters. The characters can be alphanumeric characters or symbols,
-- such as underscores (_) or hyphens (-). A journey name can\'t contain
-- any spaces.
newWriteJourneyRequest ::
  -- | 'name'
  Prelude.Text ->
  WriteJourneyRequest
newWriteJourneyRequest :: Text -> WriteJourneyRequest
newWriteJourneyRequest Text
pName_ =
  WriteJourneyRequest' :: Maybe State
-> Maybe Text
-> Maybe JourneySchedule
-> Maybe Bool
-> Maybe (HashMap Text Activity)
-> Maybe Bool
-> Maybe JourneyLimits
-> Maybe Bool
-> Maybe QuietTime
-> Maybe Text
-> Maybe Text
-> Maybe StartCondition
-> Maybe Text
-> Text
-> WriteJourneyRequest
WriteJourneyRequest'
    { $sel:state:WriteJourneyRequest' :: Maybe State
state = Maybe State
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedDate:WriteJourneyRequest' :: Maybe Text
lastModifiedDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:schedule:WriteJourneyRequest' :: Maybe JourneySchedule
schedule = Maybe JourneySchedule
forall a. Maybe a
Prelude.Nothing,
      $sel:localTime:WriteJourneyRequest' :: Maybe Bool
localTime = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:activities:WriteJourneyRequest' :: Maybe (HashMap Text Activity)
activities = Maybe (HashMap Text Activity)
forall a. Maybe a
Prelude.Nothing,
      $sel:refreshOnSegmentUpdate:WriteJourneyRequest' :: Maybe Bool
refreshOnSegmentUpdate = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:limits:WriteJourneyRequest' :: Maybe JourneyLimits
limits = Maybe JourneyLimits
forall a. Maybe a
Prelude.Nothing,
      $sel:waitForQuietTime:WriteJourneyRequest' :: Maybe Bool
waitForQuietTime = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:quietTime:WriteJourneyRequest' :: Maybe QuietTime
quietTime = Maybe QuietTime
forall a. Maybe a
Prelude.Nothing,
      $sel:startActivity:WriteJourneyRequest' :: Maybe Text
startActivity = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:WriteJourneyRequest' :: Maybe Text
creationDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startCondition:WriteJourneyRequest' :: Maybe StartCondition
startCondition = Maybe StartCondition
forall a. Maybe a
Prelude.Nothing,
      $sel:refreshFrequency:WriteJourneyRequest' :: Maybe Text
refreshFrequency = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:WriteJourneyRequest' :: Text
name = Text
pName_
    }

-- | The status of the journey. Valid values are:
--
-- -   DRAFT - Saves the journey and doesn\'t publish it.
--
-- -   ACTIVE - Saves and publishes the journey. Depending on the
--     journey\'s schedule, the journey starts running immediately or at
--     the scheduled start time. If a journey\'s status is ACTIVE, you
--     can\'t add, change, or remove activities from it.
--
-- PAUSED, CANCELLED, COMPLETED, and CLOSED states are not supported in
-- requests to create or update a journey. To cancel, pause, or resume a
-- journey, use the Journey State resource.
writeJourneyRequest_state :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe State)
writeJourneyRequest_state :: (Maybe State -> f (Maybe State))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_state = (WriteJourneyRequest -> Maybe State)
-> (WriteJourneyRequest -> Maybe State -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest WriteJourneyRequest (Maybe State) (Maybe State)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe State
state :: Maybe State
$sel:state:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe State
state} -> Maybe State
state) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe State
a -> WriteJourneyRequest
s {$sel:state:WriteJourneyRequest' :: Maybe State
state = Maybe State
a} :: WriteJourneyRequest)

-- | The date, in ISO 8601 format, when the journey was last modified.
writeJourneyRequest_lastModifiedDate :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe Prelude.Text)
writeJourneyRequest_lastModifiedDate :: (Maybe Text -> f (Maybe Text))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_lastModifiedDate = (WriteJourneyRequest -> Maybe Text)
-> (WriteJourneyRequest -> Maybe Text -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest WriteJourneyRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe Text
lastModifiedDate :: Maybe Text
$sel:lastModifiedDate:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Text
lastModifiedDate} -> Maybe Text
lastModifiedDate) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe Text
a -> WriteJourneyRequest
s {$sel:lastModifiedDate:WriteJourneyRequest' :: Maybe Text
lastModifiedDate = Maybe Text
a} :: WriteJourneyRequest)

-- | The schedule settings for the journey.
writeJourneyRequest_schedule :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe JourneySchedule)
writeJourneyRequest_schedule :: (Maybe JourneySchedule -> f (Maybe JourneySchedule))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_schedule = (WriteJourneyRequest -> Maybe JourneySchedule)
-> (WriteJourneyRequest
    -> Maybe JourneySchedule -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest
     WriteJourneyRequest
     (Maybe JourneySchedule)
     (Maybe JourneySchedule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe JourneySchedule
schedule :: Maybe JourneySchedule
$sel:schedule:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe JourneySchedule
schedule} -> Maybe JourneySchedule
schedule) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe JourneySchedule
a -> WriteJourneyRequest
s {$sel:schedule:WriteJourneyRequest' :: Maybe JourneySchedule
schedule = Maybe JourneySchedule
a} :: WriteJourneyRequest)

-- | Specifies whether the journey\'s scheduled start and end times use each
-- participant\'s local time. To base the schedule on each participant\'s
-- local time, set this value to true.
writeJourneyRequest_localTime :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe Prelude.Bool)
writeJourneyRequest_localTime :: (Maybe Bool -> f (Maybe Bool))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_localTime = (WriteJourneyRequest -> Maybe Bool)
-> (WriteJourneyRequest -> Maybe Bool -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest WriteJourneyRequest (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe Bool
localTime :: Maybe Bool
$sel:localTime:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Bool
localTime} -> Maybe Bool
localTime) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe Bool
a -> WriteJourneyRequest
s {$sel:localTime:WriteJourneyRequest' :: Maybe Bool
localTime = Maybe Bool
a} :: WriteJourneyRequest)

-- | A map that contains a set of Activity objects, one object for each
-- activity in the journey. For each Activity object, the key is the unique
-- identifier (string) for an activity and the value is the settings for
-- the activity. An activity identifier can contain a maximum of 100
-- characters. The characters must be alphanumeric characters.
writeJourneyRequest_activities :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text Activity))
writeJourneyRequest_activities :: (Maybe (HashMap Text Activity)
 -> f (Maybe (HashMap Text Activity)))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_activities = (WriteJourneyRequest -> Maybe (HashMap Text Activity))
-> (WriteJourneyRequest
    -> Maybe (HashMap Text Activity) -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest
     WriteJourneyRequest
     (Maybe (HashMap Text Activity))
     (Maybe (HashMap Text Activity))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe (HashMap Text Activity)
activities :: Maybe (HashMap Text Activity)
$sel:activities:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe (HashMap Text Activity)
activities} -> Maybe (HashMap Text Activity)
activities) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe (HashMap Text Activity)
a -> WriteJourneyRequest
s {$sel:activities:WriteJourneyRequest' :: Maybe (HashMap Text Activity)
activities = Maybe (HashMap Text Activity)
a} :: WriteJourneyRequest) ((Maybe (HashMap Text Activity)
  -> f (Maybe (HashMap Text Activity)))
 -> WriteJourneyRequest -> f WriteJourneyRequest)
-> ((Maybe (HashMap Text Activity)
     -> f (Maybe (HashMap Text Activity)))
    -> Maybe (HashMap Text Activity)
    -> f (Maybe (HashMap Text Activity)))
-> (Maybe (HashMap Text Activity)
    -> f (Maybe (HashMap Text Activity)))
-> WriteJourneyRequest
-> f WriteJourneyRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Activity)
  (HashMap Text Activity)
  (HashMap Text Activity)
  (HashMap Text Activity)
-> Iso
     (Maybe (HashMap Text Activity))
     (Maybe (HashMap Text Activity))
     (Maybe (HashMap Text Activity))
     (Maybe (HashMap Text Activity))
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 AnIso
  (HashMap Text Activity)
  (HashMap Text Activity)
  (HashMap Text Activity)
  (HashMap Text Activity)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies whether a journey should be refreshed on segment update.
writeJourneyRequest_refreshOnSegmentUpdate :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe Prelude.Bool)
writeJourneyRequest_refreshOnSegmentUpdate :: (Maybe Bool -> f (Maybe Bool))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_refreshOnSegmentUpdate = (WriteJourneyRequest -> Maybe Bool)
-> (WriteJourneyRequest -> Maybe Bool -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest WriteJourneyRequest (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe Bool
refreshOnSegmentUpdate :: Maybe Bool
$sel:refreshOnSegmentUpdate:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Bool
refreshOnSegmentUpdate} -> Maybe Bool
refreshOnSegmentUpdate) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe Bool
a -> WriteJourneyRequest
s {$sel:refreshOnSegmentUpdate:WriteJourneyRequest' :: Maybe Bool
refreshOnSegmentUpdate = Maybe Bool
a} :: WriteJourneyRequest)

-- | The messaging and entry limits for the journey.
writeJourneyRequest_limits :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe JourneyLimits)
writeJourneyRequest_limits :: (Maybe JourneyLimits -> f (Maybe JourneyLimits))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_limits = (WriteJourneyRequest -> Maybe JourneyLimits)
-> (WriteJourneyRequest
    -> Maybe JourneyLimits -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest
     WriteJourneyRequest
     (Maybe JourneyLimits)
     (Maybe JourneyLimits)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe JourneyLimits
limits :: Maybe JourneyLimits
$sel:limits:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe JourneyLimits
limits} -> Maybe JourneyLimits
limits) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe JourneyLimits
a -> WriteJourneyRequest
s {$sel:limits:WriteJourneyRequest' :: Maybe JourneyLimits
limits = Maybe JourneyLimits
a} :: WriteJourneyRequest)

-- | Specifies whether endpoints in quiet hours should enter a wait till the
-- end of their quiet hours.
writeJourneyRequest_waitForQuietTime :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe Prelude.Bool)
writeJourneyRequest_waitForQuietTime :: (Maybe Bool -> f (Maybe Bool))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_waitForQuietTime = (WriteJourneyRequest -> Maybe Bool)
-> (WriteJourneyRequest -> Maybe Bool -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest WriteJourneyRequest (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe Bool
waitForQuietTime :: Maybe Bool
$sel:waitForQuietTime:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Bool
waitForQuietTime} -> Maybe Bool
waitForQuietTime) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe Bool
a -> WriteJourneyRequest
s {$sel:waitForQuietTime:WriteJourneyRequest' :: Maybe Bool
waitForQuietTime = Maybe Bool
a} :: WriteJourneyRequest)

-- | The quiet time settings for the journey. Quiet time is a specific time
-- range when a journey doesn\'t send messages to participants, if all the
-- following conditions are met:
--
-- -   The EndpointDemographic.Timezone property of the endpoint for the
--     participant is set to a valid value.
--
-- -   The current time in the participant\'s time zone is later than or
--     equal to the time specified by the QuietTime.Start property for the
--     journey.
--
-- -   The current time in the participant\'s time zone is earlier than or
--     equal to the time specified by the QuietTime.End property for the
--     journey.
--
-- If any of the preceding conditions isn\'t met, the participant will
-- receive messages from the journey, even if quiet time is enabled.
writeJourneyRequest_quietTime :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe QuietTime)
writeJourneyRequest_quietTime :: (Maybe QuietTime -> f (Maybe QuietTime))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_quietTime = (WriteJourneyRequest -> Maybe QuietTime)
-> (WriteJourneyRequest -> Maybe QuietTime -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest
     WriteJourneyRequest
     (Maybe QuietTime)
     (Maybe QuietTime)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe QuietTime
quietTime :: Maybe QuietTime
$sel:quietTime:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe QuietTime
quietTime} -> Maybe QuietTime
quietTime) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe QuietTime
a -> WriteJourneyRequest
s {$sel:quietTime:WriteJourneyRequest' :: Maybe QuietTime
quietTime = Maybe QuietTime
a} :: WriteJourneyRequest)

-- | The unique identifier for the first activity in the journey. The
-- identifier for this activity can contain a maximum of 128 characters.
-- The characters must be alphanumeric characters.
writeJourneyRequest_startActivity :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe Prelude.Text)
writeJourneyRequest_startActivity :: (Maybe Text -> f (Maybe Text))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_startActivity = (WriteJourneyRequest -> Maybe Text)
-> (WriteJourneyRequest -> Maybe Text -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest WriteJourneyRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe Text
startActivity :: Maybe Text
$sel:startActivity:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Text
startActivity} -> Maybe Text
startActivity) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe Text
a -> WriteJourneyRequest
s {$sel:startActivity:WriteJourneyRequest' :: Maybe Text
startActivity = Maybe Text
a} :: WriteJourneyRequest)

-- | The date, in ISO 8601 format, when the journey was created.
writeJourneyRequest_creationDate :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe Prelude.Text)
writeJourneyRequest_creationDate :: (Maybe Text -> f (Maybe Text))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_creationDate = (WriteJourneyRequest -> Maybe Text)
-> (WriteJourneyRequest -> Maybe Text -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest WriteJourneyRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe Text
creationDate :: Maybe Text
$sel:creationDate:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Text
creationDate} -> Maybe Text
creationDate) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe Text
a -> WriteJourneyRequest
s {$sel:creationDate:WriteJourneyRequest' :: Maybe Text
creationDate = Maybe Text
a} :: WriteJourneyRequest)

-- | The segment that defines which users are participants in the journey.
writeJourneyRequest_startCondition :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe StartCondition)
writeJourneyRequest_startCondition :: (Maybe StartCondition -> f (Maybe StartCondition))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_startCondition = (WriteJourneyRequest -> Maybe StartCondition)
-> (WriteJourneyRequest
    -> Maybe StartCondition -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest
     WriteJourneyRequest
     (Maybe StartCondition)
     (Maybe StartCondition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe StartCondition
startCondition :: Maybe StartCondition
$sel:startCondition:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe StartCondition
startCondition} -> Maybe StartCondition
startCondition) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe StartCondition
a -> WriteJourneyRequest
s {$sel:startCondition:WriteJourneyRequest' :: Maybe StartCondition
startCondition = Maybe StartCondition
a} :: WriteJourneyRequest)

-- | The frequency with which Amazon Pinpoint evaluates segment and event
-- data for the journey, as a duration in ISO 8601 format.
writeJourneyRequest_refreshFrequency :: Lens.Lens' WriteJourneyRequest (Prelude.Maybe Prelude.Text)
writeJourneyRequest_refreshFrequency :: (Maybe Text -> f (Maybe Text))
-> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_refreshFrequency = (WriteJourneyRequest -> Maybe Text)
-> (WriteJourneyRequest -> Maybe Text -> WriteJourneyRequest)
-> Lens
     WriteJourneyRequest WriteJourneyRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Maybe Text
refreshFrequency :: Maybe Text
$sel:refreshFrequency:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Text
refreshFrequency} -> Maybe Text
refreshFrequency) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Maybe Text
a -> WriteJourneyRequest
s {$sel:refreshFrequency:WriteJourneyRequest' :: Maybe Text
refreshFrequency = Maybe Text
a} :: WriteJourneyRequest)

-- | The name of the journey. A journey name can contain a maximum of 150
-- characters. The characters can be alphanumeric characters or symbols,
-- such as underscores (_) or hyphens (-). A journey name can\'t contain
-- any spaces.
writeJourneyRequest_name :: Lens.Lens' WriteJourneyRequest Prelude.Text
writeJourneyRequest_name :: (Text -> f Text) -> WriteJourneyRequest -> f WriteJourneyRequest
writeJourneyRequest_name = (WriteJourneyRequest -> Text)
-> (WriteJourneyRequest -> Text -> WriteJourneyRequest)
-> Lens WriteJourneyRequest WriteJourneyRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WriteJourneyRequest' {Text
name :: Text
$sel:name:WriteJourneyRequest' :: WriteJourneyRequest -> Text
name} -> Text
name) (\s :: WriteJourneyRequest
s@WriteJourneyRequest' {} Text
a -> WriteJourneyRequest
s {$sel:name:WriteJourneyRequest' :: Text
name = Text
a} :: WriteJourneyRequest)

instance Prelude.Hashable WriteJourneyRequest

instance Prelude.NFData WriteJourneyRequest

instance Core.ToJSON WriteJourneyRequest where
  toJSON :: WriteJourneyRequest -> Value
toJSON WriteJourneyRequest' {Maybe Bool
Maybe Text
Maybe (HashMap Text Activity)
Maybe JourneyLimits
Maybe JourneySchedule
Maybe QuietTime
Maybe StartCondition
Maybe State
Text
name :: Text
refreshFrequency :: Maybe Text
startCondition :: Maybe StartCondition
creationDate :: Maybe Text
startActivity :: Maybe Text
quietTime :: Maybe QuietTime
waitForQuietTime :: Maybe Bool
limits :: Maybe JourneyLimits
refreshOnSegmentUpdate :: Maybe Bool
activities :: Maybe (HashMap Text Activity)
localTime :: Maybe Bool
schedule :: Maybe JourneySchedule
lastModifiedDate :: Maybe Text
state :: Maybe State
$sel:name:WriteJourneyRequest' :: WriteJourneyRequest -> Text
$sel:refreshFrequency:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Text
$sel:startCondition:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe StartCondition
$sel:creationDate:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Text
$sel:startActivity:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Text
$sel:quietTime:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe QuietTime
$sel:waitForQuietTime:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Bool
$sel:limits:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe JourneyLimits
$sel:refreshOnSegmentUpdate:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Bool
$sel:activities:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe (HashMap Text Activity)
$sel:localTime:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Bool
$sel:schedule:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe JourneySchedule
$sel:lastModifiedDate:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe Text
$sel:state:WriteJourneyRequest' :: WriteJourneyRequest -> Maybe State
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"State" Text -> State -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (State -> Pair) -> Maybe State -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe State
state,
            (Text
"LastModifiedDate" 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
lastModifiedDate,
            (Text
"Schedule" Text -> JourneySchedule -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (JourneySchedule -> Pair) -> Maybe JourneySchedule -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe JourneySchedule
schedule,
            (Text
"LocalTime" 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
localTime,
            (Text
"Activities" Text -> HashMap Text Activity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Activity -> Pair)
-> Maybe (HashMap Text Activity) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Activity)
activities,
            (Text
"RefreshOnSegmentUpdate" 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
refreshOnSegmentUpdate,
            (Text
"Limits" Text -> JourneyLimits -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (JourneyLimits -> Pair) -> Maybe JourneyLimits -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe JourneyLimits
limits,
            (Text
"WaitForQuietTime" 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
waitForQuietTime,
            (Text
"QuietTime" Text -> QuietTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (QuietTime -> Pair) -> Maybe QuietTime -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe QuietTime
quietTime,
            (Text
"StartActivity" 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
startActivity,
            (Text
"CreationDate" 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
creationDate,
            (Text
"StartCondition" Text -> StartCondition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (StartCondition -> Pair) -> Maybe StartCondition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StartCondition
startCondition,
            (Text
"RefreshFrequency" 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
refreshFrequency,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )