{-# 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.JourneyStateRequest
-- 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.JourneyStateRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.State
import qualified Amazonka.Prelude as Prelude

-- | Changes the status of a journey.
--
-- /See:/ 'newJourneyStateRequest' smart constructor.
data JourneyStateRequest = JourneyStateRequest'
  { -- | The status of the journey. Currently, Supported values are ACTIVE,
    -- PAUSED, and CANCELLED
    --
    -- If you cancel a journey, Amazon Pinpoint continues to perform activities
    -- that are currently in progress, until those activities are complete.
    -- Amazon Pinpoint also continues to collect and aggregate analytics data
    -- for those activities, until they are complete, and any activities that
    -- were complete when you cancelled the journey.
    --
    -- After you cancel a journey, you can\'t add, change, or remove any
    -- activities from the journey. In addition, Amazon Pinpoint stops
    -- evaluating the journey and doesn\'t perform any activities that haven\'t
    -- started.
    --
    -- When the journey is paused, Amazon Pinpoint continues to perform
    -- activities that are currently in progress, until those activities are
    -- complete. Endpoints will stop entering journeys when the journey is
    -- paused and will resume entering the journey after the journey is
    -- resumed. For wait activities, wait time is paused when the journey is
    -- paused. Currently, PAUSED only supports journeys with a segment refresh
    -- interval.
    JourneyStateRequest -> Maybe State
state :: Prelude.Maybe State
  }
  deriving (JourneyStateRequest -> JourneyStateRequest -> Bool
(JourneyStateRequest -> JourneyStateRequest -> Bool)
-> (JourneyStateRequest -> JourneyStateRequest -> Bool)
-> Eq JourneyStateRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JourneyStateRequest -> JourneyStateRequest -> Bool
$c/= :: JourneyStateRequest -> JourneyStateRequest -> Bool
== :: JourneyStateRequest -> JourneyStateRequest -> Bool
$c== :: JourneyStateRequest -> JourneyStateRequest -> Bool
Prelude.Eq, ReadPrec [JourneyStateRequest]
ReadPrec JourneyStateRequest
Int -> ReadS JourneyStateRequest
ReadS [JourneyStateRequest]
(Int -> ReadS JourneyStateRequest)
-> ReadS [JourneyStateRequest]
-> ReadPrec JourneyStateRequest
-> ReadPrec [JourneyStateRequest]
-> Read JourneyStateRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JourneyStateRequest]
$creadListPrec :: ReadPrec [JourneyStateRequest]
readPrec :: ReadPrec JourneyStateRequest
$creadPrec :: ReadPrec JourneyStateRequest
readList :: ReadS [JourneyStateRequest]
$creadList :: ReadS [JourneyStateRequest]
readsPrec :: Int -> ReadS JourneyStateRequest
$creadsPrec :: Int -> ReadS JourneyStateRequest
Prelude.Read, Int -> JourneyStateRequest -> ShowS
[JourneyStateRequest] -> ShowS
JourneyStateRequest -> String
(Int -> JourneyStateRequest -> ShowS)
-> (JourneyStateRequest -> String)
-> ([JourneyStateRequest] -> ShowS)
-> Show JourneyStateRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JourneyStateRequest] -> ShowS
$cshowList :: [JourneyStateRequest] -> ShowS
show :: JourneyStateRequest -> String
$cshow :: JourneyStateRequest -> String
showsPrec :: Int -> JourneyStateRequest -> ShowS
$cshowsPrec :: Int -> JourneyStateRequest -> ShowS
Prelude.Show, (forall x. JourneyStateRequest -> Rep JourneyStateRequest x)
-> (forall x. Rep JourneyStateRequest x -> JourneyStateRequest)
-> Generic JourneyStateRequest
forall x. Rep JourneyStateRequest x -> JourneyStateRequest
forall x. JourneyStateRequest -> Rep JourneyStateRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JourneyStateRequest x -> JourneyStateRequest
$cfrom :: forall x. JourneyStateRequest -> Rep JourneyStateRequest x
Prelude.Generic)

-- |
-- Create a value of 'JourneyStateRequest' 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', 'journeyStateRequest_state' - The status of the journey. Currently, Supported values are ACTIVE,
-- PAUSED, and CANCELLED
--
-- If you cancel a journey, Amazon Pinpoint continues to perform activities
-- that are currently in progress, until those activities are complete.
-- Amazon Pinpoint also continues to collect and aggregate analytics data
-- for those activities, until they are complete, and any activities that
-- were complete when you cancelled the journey.
--
-- After you cancel a journey, you can\'t add, change, or remove any
-- activities from the journey. In addition, Amazon Pinpoint stops
-- evaluating the journey and doesn\'t perform any activities that haven\'t
-- started.
--
-- When the journey is paused, Amazon Pinpoint continues to perform
-- activities that are currently in progress, until those activities are
-- complete. Endpoints will stop entering journeys when the journey is
-- paused and will resume entering the journey after the journey is
-- resumed. For wait activities, wait time is paused when the journey is
-- paused. Currently, PAUSED only supports journeys with a segment refresh
-- interval.
newJourneyStateRequest ::
  JourneyStateRequest
newJourneyStateRequest :: JourneyStateRequest
newJourneyStateRequest =
  JourneyStateRequest' :: Maybe State -> JourneyStateRequest
JourneyStateRequest' {$sel:state:JourneyStateRequest' :: Maybe State
state = Maybe State
forall a. Maybe a
Prelude.Nothing}

-- | The status of the journey. Currently, Supported values are ACTIVE,
-- PAUSED, and CANCELLED
--
-- If you cancel a journey, Amazon Pinpoint continues to perform activities
-- that are currently in progress, until those activities are complete.
-- Amazon Pinpoint also continues to collect and aggregate analytics data
-- for those activities, until they are complete, and any activities that
-- were complete when you cancelled the journey.
--
-- After you cancel a journey, you can\'t add, change, or remove any
-- activities from the journey. In addition, Amazon Pinpoint stops
-- evaluating the journey and doesn\'t perform any activities that haven\'t
-- started.
--
-- When the journey is paused, Amazon Pinpoint continues to perform
-- activities that are currently in progress, until those activities are
-- complete. Endpoints will stop entering journeys when the journey is
-- paused and will resume entering the journey after the journey is
-- resumed. For wait activities, wait time is paused when the journey is
-- paused. Currently, PAUSED only supports journeys with a segment refresh
-- interval.
journeyStateRequest_state :: Lens.Lens' JourneyStateRequest (Prelude.Maybe State)
journeyStateRequest_state :: (Maybe State -> f (Maybe State))
-> JourneyStateRequest -> f JourneyStateRequest
journeyStateRequest_state = (JourneyStateRequest -> Maybe State)
-> (JourneyStateRequest -> Maybe State -> JourneyStateRequest)
-> Lens
     JourneyStateRequest JourneyStateRequest (Maybe State) (Maybe State)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyStateRequest' {Maybe State
state :: Maybe State
$sel:state:JourneyStateRequest' :: JourneyStateRequest -> Maybe State
state} -> Maybe State
state) (\s :: JourneyStateRequest
s@JourneyStateRequest' {} Maybe State
a -> JourneyStateRequest
s {$sel:state:JourneyStateRequest' :: Maybe State
state = Maybe State
a} :: JourneyStateRequest)

instance Prelude.Hashable JourneyStateRequest

instance Prelude.NFData JourneyStateRequest

instance Core.ToJSON JourneyStateRequest where
  toJSON :: JourneyStateRequest -> Value
toJSON JourneyStateRequest' {Maybe State
state :: Maybe State
$sel:state:JourneyStateRequest' :: JourneyStateRequest -> 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]
      )