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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides the results of a query that retrieved the data for a standard
-- execution metric that applies to a journey, and provides information
-- about that query.
--
-- /See:/ 'newJourneyExecutionMetricsResponse' smart constructor.
data JourneyExecutionMetricsResponse = JourneyExecutionMetricsResponse'
  { -- | A JSON object that contains the results of the query. For information
    -- about the structure and contents of the results, see the
    -- <https://docs.aws.amazon.com//pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
    JourneyExecutionMetricsResponse -> HashMap Text Text
metrics :: Prelude.HashMap Prelude.Text Prelude.Text,
    -- | The unique identifier for the journey that the metric applies to.
    JourneyExecutionMetricsResponse -> Text
journeyId :: Prelude.Text,
    -- | The date and time, in ISO 8601 format, when Amazon Pinpoint last
    -- evaluated the journey and updated the data for the metric.
    JourneyExecutionMetricsResponse -> Text
lastEvaluatedTime :: Prelude.Text,
    -- | The unique identifier for the application that the metric applies to.
    JourneyExecutionMetricsResponse -> Text
applicationId :: Prelude.Text
  }
  deriving (JourneyExecutionMetricsResponse
-> JourneyExecutionMetricsResponse -> Bool
(JourneyExecutionMetricsResponse
 -> JourneyExecutionMetricsResponse -> Bool)
-> (JourneyExecutionMetricsResponse
    -> JourneyExecutionMetricsResponse -> Bool)
-> Eq JourneyExecutionMetricsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JourneyExecutionMetricsResponse
-> JourneyExecutionMetricsResponse -> Bool
$c/= :: JourneyExecutionMetricsResponse
-> JourneyExecutionMetricsResponse -> Bool
== :: JourneyExecutionMetricsResponse
-> JourneyExecutionMetricsResponse -> Bool
$c== :: JourneyExecutionMetricsResponse
-> JourneyExecutionMetricsResponse -> Bool
Prelude.Eq, ReadPrec [JourneyExecutionMetricsResponse]
ReadPrec JourneyExecutionMetricsResponse
Int -> ReadS JourneyExecutionMetricsResponse
ReadS [JourneyExecutionMetricsResponse]
(Int -> ReadS JourneyExecutionMetricsResponse)
-> ReadS [JourneyExecutionMetricsResponse]
-> ReadPrec JourneyExecutionMetricsResponse
-> ReadPrec [JourneyExecutionMetricsResponse]
-> Read JourneyExecutionMetricsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JourneyExecutionMetricsResponse]
$creadListPrec :: ReadPrec [JourneyExecutionMetricsResponse]
readPrec :: ReadPrec JourneyExecutionMetricsResponse
$creadPrec :: ReadPrec JourneyExecutionMetricsResponse
readList :: ReadS [JourneyExecutionMetricsResponse]
$creadList :: ReadS [JourneyExecutionMetricsResponse]
readsPrec :: Int -> ReadS JourneyExecutionMetricsResponse
$creadsPrec :: Int -> ReadS JourneyExecutionMetricsResponse
Prelude.Read, Int -> JourneyExecutionMetricsResponse -> ShowS
[JourneyExecutionMetricsResponse] -> ShowS
JourneyExecutionMetricsResponse -> String
(Int -> JourneyExecutionMetricsResponse -> ShowS)
-> (JourneyExecutionMetricsResponse -> String)
-> ([JourneyExecutionMetricsResponse] -> ShowS)
-> Show JourneyExecutionMetricsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JourneyExecutionMetricsResponse] -> ShowS
$cshowList :: [JourneyExecutionMetricsResponse] -> ShowS
show :: JourneyExecutionMetricsResponse -> String
$cshow :: JourneyExecutionMetricsResponse -> String
showsPrec :: Int -> JourneyExecutionMetricsResponse -> ShowS
$cshowsPrec :: Int -> JourneyExecutionMetricsResponse -> ShowS
Prelude.Show, (forall x.
 JourneyExecutionMetricsResponse
 -> Rep JourneyExecutionMetricsResponse x)
-> (forall x.
    Rep JourneyExecutionMetricsResponse x
    -> JourneyExecutionMetricsResponse)
-> Generic JourneyExecutionMetricsResponse
forall x.
Rep JourneyExecutionMetricsResponse x
-> JourneyExecutionMetricsResponse
forall x.
JourneyExecutionMetricsResponse
-> Rep JourneyExecutionMetricsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep JourneyExecutionMetricsResponse x
-> JourneyExecutionMetricsResponse
$cfrom :: forall x.
JourneyExecutionMetricsResponse
-> Rep JourneyExecutionMetricsResponse x
Prelude.Generic)

-- |
-- Create a value of 'JourneyExecutionMetricsResponse' 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:
--
-- 'metrics', 'journeyExecutionMetricsResponse_metrics' - A JSON object that contains the results of the query. For information
-- about the structure and contents of the results, see the
-- <https://docs.aws.amazon.com//pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
--
-- 'journeyId', 'journeyExecutionMetricsResponse_journeyId' - The unique identifier for the journey that the metric applies to.
--
-- 'lastEvaluatedTime', 'journeyExecutionMetricsResponse_lastEvaluatedTime' - The date and time, in ISO 8601 format, when Amazon Pinpoint last
-- evaluated the journey and updated the data for the metric.
--
-- 'applicationId', 'journeyExecutionMetricsResponse_applicationId' - The unique identifier for the application that the metric applies to.
newJourneyExecutionMetricsResponse ::
  -- | 'journeyId'
  Prelude.Text ->
  -- | 'lastEvaluatedTime'
  Prelude.Text ->
  -- | 'applicationId'
  Prelude.Text ->
  JourneyExecutionMetricsResponse
newJourneyExecutionMetricsResponse :: Text -> Text -> Text -> JourneyExecutionMetricsResponse
newJourneyExecutionMetricsResponse
  Text
pJourneyId_
  Text
pLastEvaluatedTime_
  Text
pApplicationId_ =
    JourneyExecutionMetricsResponse' :: HashMap Text Text
-> Text -> Text -> Text -> JourneyExecutionMetricsResponse
JourneyExecutionMetricsResponse'
      { $sel:metrics:JourneyExecutionMetricsResponse' :: HashMap Text Text
metrics =
          HashMap Text Text
forall a. Monoid a => a
Prelude.mempty,
        $sel:journeyId:JourneyExecutionMetricsResponse' :: Text
journeyId = Text
pJourneyId_,
        $sel:lastEvaluatedTime:JourneyExecutionMetricsResponse' :: Text
lastEvaluatedTime = Text
pLastEvaluatedTime_,
        $sel:applicationId:JourneyExecutionMetricsResponse' :: Text
applicationId = Text
pApplicationId_
      }

-- | A JSON object that contains the results of the query. For information
-- about the structure and contents of the results, see the
-- <https://docs.aws.amazon.com//pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
journeyExecutionMetricsResponse_metrics :: Lens.Lens' JourneyExecutionMetricsResponse (Prelude.HashMap Prelude.Text Prelude.Text)
journeyExecutionMetricsResponse_metrics :: (HashMap Text Text -> f (HashMap Text Text))
-> JourneyExecutionMetricsResponse
-> f JourneyExecutionMetricsResponse
journeyExecutionMetricsResponse_metrics = (JourneyExecutionMetricsResponse -> HashMap Text Text)
-> (JourneyExecutionMetricsResponse
    -> HashMap Text Text -> JourneyExecutionMetricsResponse)
-> Lens
     JourneyExecutionMetricsResponse
     JourneyExecutionMetricsResponse
     (HashMap Text Text)
     (HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyExecutionMetricsResponse' {HashMap Text Text
metrics :: HashMap Text Text
$sel:metrics:JourneyExecutionMetricsResponse' :: JourneyExecutionMetricsResponse -> HashMap Text Text
metrics} -> HashMap Text Text
metrics) (\s :: JourneyExecutionMetricsResponse
s@JourneyExecutionMetricsResponse' {} HashMap Text Text
a -> JourneyExecutionMetricsResponse
s {$sel:metrics:JourneyExecutionMetricsResponse' :: HashMap Text Text
metrics = HashMap Text Text
a} :: JourneyExecutionMetricsResponse) ((HashMap Text Text -> f (HashMap Text Text))
 -> JourneyExecutionMetricsResponse
 -> f JourneyExecutionMetricsResponse)
-> ((HashMap Text Text -> f (HashMap Text Text))
    -> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> JourneyExecutionMetricsResponse
-> f JourneyExecutionMetricsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The unique identifier for the journey that the metric applies to.
journeyExecutionMetricsResponse_journeyId :: Lens.Lens' JourneyExecutionMetricsResponse Prelude.Text
journeyExecutionMetricsResponse_journeyId :: (Text -> f Text)
-> JourneyExecutionMetricsResponse
-> f JourneyExecutionMetricsResponse
journeyExecutionMetricsResponse_journeyId = (JourneyExecutionMetricsResponse -> Text)
-> (JourneyExecutionMetricsResponse
    -> Text -> JourneyExecutionMetricsResponse)
-> Lens
     JourneyExecutionMetricsResponse
     JourneyExecutionMetricsResponse
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyExecutionMetricsResponse' {Text
journeyId :: Text
$sel:journeyId:JourneyExecutionMetricsResponse' :: JourneyExecutionMetricsResponse -> Text
journeyId} -> Text
journeyId) (\s :: JourneyExecutionMetricsResponse
s@JourneyExecutionMetricsResponse' {} Text
a -> JourneyExecutionMetricsResponse
s {$sel:journeyId:JourneyExecutionMetricsResponse' :: Text
journeyId = Text
a} :: JourneyExecutionMetricsResponse)

-- | The date and time, in ISO 8601 format, when Amazon Pinpoint last
-- evaluated the journey and updated the data for the metric.
journeyExecutionMetricsResponse_lastEvaluatedTime :: Lens.Lens' JourneyExecutionMetricsResponse Prelude.Text
journeyExecutionMetricsResponse_lastEvaluatedTime :: (Text -> f Text)
-> JourneyExecutionMetricsResponse
-> f JourneyExecutionMetricsResponse
journeyExecutionMetricsResponse_lastEvaluatedTime = (JourneyExecutionMetricsResponse -> Text)
-> (JourneyExecutionMetricsResponse
    -> Text -> JourneyExecutionMetricsResponse)
-> Lens
     JourneyExecutionMetricsResponse
     JourneyExecutionMetricsResponse
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyExecutionMetricsResponse' {Text
lastEvaluatedTime :: Text
$sel:lastEvaluatedTime:JourneyExecutionMetricsResponse' :: JourneyExecutionMetricsResponse -> Text
lastEvaluatedTime} -> Text
lastEvaluatedTime) (\s :: JourneyExecutionMetricsResponse
s@JourneyExecutionMetricsResponse' {} Text
a -> JourneyExecutionMetricsResponse
s {$sel:lastEvaluatedTime:JourneyExecutionMetricsResponse' :: Text
lastEvaluatedTime = Text
a} :: JourneyExecutionMetricsResponse)

-- | The unique identifier for the application that the metric applies to.
journeyExecutionMetricsResponse_applicationId :: Lens.Lens' JourneyExecutionMetricsResponse Prelude.Text
journeyExecutionMetricsResponse_applicationId :: (Text -> f Text)
-> JourneyExecutionMetricsResponse
-> f JourneyExecutionMetricsResponse
journeyExecutionMetricsResponse_applicationId = (JourneyExecutionMetricsResponse -> Text)
-> (JourneyExecutionMetricsResponse
    -> Text -> JourneyExecutionMetricsResponse)
-> Lens
     JourneyExecutionMetricsResponse
     JourneyExecutionMetricsResponse
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyExecutionMetricsResponse' {Text
applicationId :: Text
$sel:applicationId:JourneyExecutionMetricsResponse' :: JourneyExecutionMetricsResponse -> Text
applicationId} -> Text
applicationId) (\s :: JourneyExecutionMetricsResponse
s@JourneyExecutionMetricsResponse' {} Text
a -> JourneyExecutionMetricsResponse
s {$sel:applicationId:JourneyExecutionMetricsResponse' :: Text
applicationId = Text
a} :: JourneyExecutionMetricsResponse)

instance
  Core.FromJSON
    JourneyExecutionMetricsResponse
  where
  parseJSON :: Value -> Parser JourneyExecutionMetricsResponse
parseJSON =
    String
-> (Object -> Parser JourneyExecutionMetricsResponse)
-> Value
-> Parser JourneyExecutionMetricsResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JourneyExecutionMetricsResponse"
      ( \Object
x ->
          HashMap Text Text
-> Text -> Text -> Text -> JourneyExecutionMetricsResponse
JourneyExecutionMetricsResponse'
            (HashMap Text Text
 -> Text -> Text -> Text -> JourneyExecutionMetricsResponse)
-> Parser (HashMap Text Text)
-> Parser (Text -> Text -> Text -> JourneyExecutionMetricsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (HashMap Text Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Metrics" Parser (Maybe (HashMap Text Text))
-> HashMap Text Text -> Parser (HashMap Text Text)
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= HashMap Text Text
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> Text -> Text -> JourneyExecutionMetricsResponse)
-> Parser Text
-> Parser (Text -> Text -> JourneyExecutionMetricsResponse)
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
"JourneyId")
            Parser (Text -> Text -> JourneyExecutionMetricsResponse)
-> Parser Text -> Parser (Text -> JourneyExecutionMetricsResponse)
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
"LastEvaluatedTime")
            Parser (Text -> JourneyExecutionMetricsResponse)
-> Parser Text -> Parser JourneyExecutionMetricsResponse
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
"ApplicationId")
      )

instance
  Prelude.Hashable
    JourneyExecutionMetricsResponse

instance
  Prelude.NFData
    JourneyExecutionMetricsResponse