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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types.BaseKpiResult
import qualified Amazonka.Prelude as Prelude

-- | Provides the results of a query that retrieved the data for a standard
-- engagement metric that applies to a journey, and provides information
-- about that query.
--
-- /See:/ 'newJourneyDateRangeKpiResponse' smart constructor.
data JourneyDateRangeKpiResponse = JourneyDateRangeKpiResponse'
  { -- | The string to use in a subsequent request to get the next page of
    -- results in a paginated response. This value is null for the Journey
    -- Engagement Metrics resource because the resource returns all results in
    -- a single page.
    JourneyDateRangeKpiResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of objects that contains the results of the query. Each object
    -- contains the value for the metric and metadata about that value.
    JourneyDateRangeKpiResponse -> BaseKpiResult
kpiResult :: BaseKpiResult,
    -- | The name of the metric, also referred to as a /key performance indicator
    -- (KPI)/, that the data was retrieved for. This value describes the
    -- associated metric and consists of two or more terms, which are comprised
    -- of lowercase alphanumeric characters, separated by a hyphen. For a list
    -- of possible values, see the
    -- <https://docs.aws.amazon.com/pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
    JourneyDateRangeKpiResponse -> Text
kpiName :: Prelude.Text,
    -- | The unique identifier for the journey that the metric applies to.
    JourneyDateRangeKpiResponse -> Text
journeyId :: Prelude.Text,
    -- | The last date and time of the date range that was used to filter the
    -- query results, in extended ISO 8601 format. The date range is inclusive.
    JourneyDateRangeKpiResponse -> ISO8601
endTime :: Data.ISO8601,
    -- | The first date and time of the date range that was used to filter the
    -- query results, in extended ISO 8601 format. The date range is inclusive.
    JourneyDateRangeKpiResponse -> ISO8601
startTime :: Data.ISO8601,
    -- | The unique identifier for the application that the metric applies to.
    JourneyDateRangeKpiResponse -> Text
applicationId :: Prelude.Text
  }
  deriving (JourneyDateRangeKpiResponse -> JourneyDateRangeKpiResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JourneyDateRangeKpiResponse -> JourneyDateRangeKpiResponse -> Bool
$c/= :: JourneyDateRangeKpiResponse -> JourneyDateRangeKpiResponse -> Bool
== :: JourneyDateRangeKpiResponse -> JourneyDateRangeKpiResponse -> Bool
$c== :: JourneyDateRangeKpiResponse -> JourneyDateRangeKpiResponse -> Bool
Prelude.Eq, ReadPrec [JourneyDateRangeKpiResponse]
ReadPrec JourneyDateRangeKpiResponse
Int -> ReadS JourneyDateRangeKpiResponse
ReadS [JourneyDateRangeKpiResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JourneyDateRangeKpiResponse]
$creadListPrec :: ReadPrec [JourneyDateRangeKpiResponse]
readPrec :: ReadPrec JourneyDateRangeKpiResponse
$creadPrec :: ReadPrec JourneyDateRangeKpiResponse
readList :: ReadS [JourneyDateRangeKpiResponse]
$creadList :: ReadS [JourneyDateRangeKpiResponse]
readsPrec :: Int -> ReadS JourneyDateRangeKpiResponse
$creadsPrec :: Int -> ReadS JourneyDateRangeKpiResponse
Prelude.Read, Int -> JourneyDateRangeKpiResponse -> ShowS
[JourneyDateRangeKpiResponse] -> ShowS
JourneyDateRangeKpiResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JourneyDateRangeKpiResponse] -> ShowS
$cshowList :: [JourneyDateRangeKpiResponse] -> ShowS
show :: JourneyDateRangeKpiResponse -> String
$cshow :: JourneyDateRangeKpiResponse -> String
showsPrec :: Int -> JourneyDateRangeKpiResponse -> ShowS
$cshowsPrec :: Int -> JourneyDateRangeKpiResponse -> ShowS
Prelude.Show, forall x.
Rep JourneyDateRangeKpiResponse x -> JourneyDateRangeKpiResponse
forall x.
JourneyDateRangeKpiResponse -> Rep JourneyDateRangeKpiResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep JourneyDateRangeKpiResponse x -> JourneyDateRangeKpiResponse
$cfrom :: forall x.
JourneyDateRangeKpiResponse -> Rep JourneyDateRangeKpiResponse x
Prelude.Generic)

-- |
-- Create a value of 'JourneyDateRangeKpiResponse' 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:
--
-- 'nextToken', 'journeyDateRangeKpiResponse_nextToken' - The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null for the Journey
-- Engagement Metrics resource because the resource returns all results in
-- a single page.
--
-- 'kpiResult', 'journeyDateRangeKpiResponse_kpiResult' - An array of objects that contains the results of the query. Each object
-- contains the value for the metric and metadata about that value.
--
-- 'kpiName', 'journeyDateRangeKpiResponse_kpiName' - The name of the metric, also referred to as a /key performance indicator
-- (KPI)/, that the data was retrieved for. This value describes the
-- associated metric and consists of two or more terms, which are comprised
-- of lowercase alphanumeric characters, separated by a hyphen. For a list
-- of possible values, see the
-- <https://docs.aws.amazon.com/pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
--
-- 'journeyId', 'journeyDateRangeKpiResponse_journeyId' - The unique identifier for the journey that the metric applies to.
--
-- 'endTime', 'journeyDateRangeKpiResponse_endTime' - The last date and time of the date range that was used to filter the
-- query results, in extended ISO 8601 format. The date range is inclusive.
--
-- 'startTime', 'journeyDateRangeKpiResponse_startTime' - The first date and time of the date range that was used to filter the
-- query results, in extended ISO 8601 format. The date range is inclusive.
--
-- 'applicationId', 'journeyDateRangeKpiResponse_applicationId' - The unique identifier for the application that the metric applies to.
newJourneyDateRangeKpiResponse ::
  -- | 'kpiResult'
  BaseKpiResult ->
  -- | 'kpiName'
  Prelude.Text ->
  -- | 'journeyId'
  Prelude.Text ->
  -- | 'endTime'
  Prelude.UTCTime ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'applicationId'
  Prelude.Text ->
  JourneyDateRangeKpiResponse
newJourneyDateRangeKpiResponse :: BaseKpiResult
-> Text
-> Text
-> UTCTime
-> UTCTime
-> Text
-> JourneyDateRangeKpiResponse
newJourneyDateRangeKpiResponse
  BaseKpiResult
pKpiResult_
  Text
pKpiName_
  Text
pJourneyId_
  UTCTime
pEndTime_
  UTCTime
pStartTime_
  Text
pApplicationId_ =
    JourneyDateRangeKpiResponse'
      { $sel:nextToken:JourneyDateRangeKpiResponse' :: Maybe Text
nextToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:kpiResult:JourneyDateRangeKpiResponse' :: BaseKpiResult
kpiResult = BaseKpiResult
pKpiResult_,
        $sel:kpiName:JourneyDateRangeKpiResponse' :: Text
kpiName = Text
pKpiName_,
        $sel:journeyId:JourneyDateRangeKpiResponse' :: Text
journeyId = Text
pJourneyId_,
        $sel:endTime:JourneyDateRangeKpiResponse' :: ISO8601
endTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_,
        $sel:startTime:JourneyDateRangeKpiResponse' :: ISO8601
startTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:applicationId:JourneyDateRangeKpiResponse' :: Text
applicationId = Text
pApplicationId_
      }

-- | The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null for the Journey
-- Engagement Metrics resource because the resource returns all results in
-- a single page.
journeyDateRangeKpiResponse_nextToken :: Lens.Lens' JourneyDateRangeKpiResponse (Prelude.Maybe Prelude.Text)
journeyDateRangeKpiResponse_nextToken :: Lens' JourneyDateRangeKpiResponse (Maybe Text)
journeyDateRangeKpiResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyDateRangeKpiResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: JourneyDateRangeKpiResponse
s@JourneyDateRangeKpiResponse' {} Maybe Text
a -> JourneyDateRangeKpiResponse
s {$sel:nextToken:JourneyDateRangeKpiResponse' :: Maybe Text
nextToken = Maybe Text
a} :: JourneyDateRangeKpiResponse)

-- | An array of objects that contains the results of the query. Each object
-- contains the value for the metric and metadata about that value.
journeyDateRangeKpiResponse_kpiResult :: Lens.Lens' JourneyDateRangeKpiResponse BaseKpiResult
journeyDateRangeKpiResponse_kpiResult :: Lens' JourneyDateRangeKpiResponse BaseKpiResult
journeyDateRangeKpiResponse_kpiResult = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyDateRangeKpiResponse' {BaseKpiResult
kpiResult :: BaseKpiResult
$sel:kpiResult:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> BaseKpiResult
kpiResult} -> BaseKpiResult
kpiResult) (\s :: JourneyDateRangeKpiResponse
s@JourneyDateRangeKpiResponse' {} BaseKpiResult
a -> JourneyDateRangeKpiResponse
s {$sel:kpiResult:JourneyDateRangeKpiResponse' :: BaseKpiResult
kpiResult = BaseKpiResult
a} :: JourneyDateRangeKpiResponse)

-- | The name of the metric, also referred to as a /key performance indicator
-- (KPI)/, that the data was retrieved for. This value describes the
-- associated metric and consists of two or more terms, which are comprised
-- of lowercase alphanumeric characters, separated by a hyphen. For a list
-- of possible values, see the
-- <https://docs.aws.amazon.com/pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
journeyDateRangeKpiResponse_kpiName :: Lens.Lens' JourneyDateRangeKpiResponse Prelude.Text
journeyDateRangeKpiResponse_kpiName :: Lens' JourneyDateRangeKpiResponse Text
journeyDateRangeKpiResponse_kpiName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyDateRangeKpiResponse' {Text
kpiName :: Text
$sel:kpiName:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> Text
kpiName} -> Text
kpiName) (\s :: JourneyDateRangeKpiResponse
s@JourneyDateRangeKpiResponse' {} Text
a -> JourneyDateRangeKpiResponse
s {$sel:kpiName:JourneyDateRangeKpiResponse' :: Text
kpiName = Text
a} :: JourneyDateRangeKpiResponse)

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

-- | The last date and time of the date range that was used to filter the
-- query results, in extended ISO 8601 format. The date range is inclusive.
journeyDateRangeKpiResponse_endTime :: Lens.Lens' JourneyDateRangeKpiResponse Prelude.UTCTime
journeyDateRangeKpiResponse_endTime :: Lens' JourneyDateRangeKpiResponse UTCTime
journeyDateRangeKpiResponse_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyDateRangeKpiResponse' {ISO8601
endTime :: ISO8601
$sel:endTime:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> ISO8601
endTime} -> ISO8601
endTime) (\s :: JourneyDateRangeKpiResponse
s@JourneyDateRangeKpiResponse' {} ISO8601
a -> JourneyDateRangeKpiResponse
s {$sel:endTime:JourneyDateRangeKpiResponse' :: ISO8601
endTime = ISO8601
a} :: JourneyDateRangeKpiResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The first date and time of the date range that was used to filter the
-- query results, in extended ISO 8601 format. The date range is inclusive.
journeyDateRangeKpiResponse_startTime :: Lens.Lens' JourneyDateRangeKpiResponse Prelude.UTCTime
journeyDateRangeKpiResponse_startTime :: Lens' JourneyDateRangeKpiResponse UTCTime
journeyDateRangeKpiResponse_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneyDateRangeKpiResponse' {ISO8601
startTime :: ISO8601
$sel:startTime:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> ISO8601
startTime} -> ISO8601
startTime) (\s :: JourneyDateRangeKpiResponse
s@JourneyDateRangeKpiResponse' {} ISO8601
a -> JourneyDateRangeKpiResponse
s {$sel:startTime:JourneyDateRangeKpiResponse' :: ISO8601
startTime = ISO8601
a} :: JourneyDateRangeKpiResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

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

instance Data.FromJSON JourneyDateRangeKpiResponse where
  parseJSON :: Value -> Parser JourneyDateRangeKpiResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"JourneyDateRangeKpiResponse"
      ( \Object
x ->
          Maybe Text
-> BaseKpiResult
-> Text
-> Text
-> ISO8601
-> ISO8601
-> Text
-> JourneyDateRangeKpiResponse
JourneyDateRangeKpiResponse'
            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
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"KpiResult")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"KpiName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"JourneyId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"EndTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"StartTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ApplicationId")
      )

instance Prelude.Hashable JourneyDateRangeKpiResponse where
  hashWithSalt :: Int -> JourneyDateRangeKpiResponse -> Int
hashWithSalt Int
_salt JourneyDateRangeKpiResponse' {Maybe Text
Text
ISO8601
BaseKpiResult
applicationId :: Text
startTime :: ISO8601
endTime :: ISO8601
journeyId :: Text
kpiName :: Text
kpiResult :: BaseKpiResult
nextToken :: Maybe Text
$sel:applicationId:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> Text
$sel:startTime:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> ISO8601
$sel:endTime:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> ISO8601
$sel:journeyId:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> Text
$sel:kpiName:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> Text
$sel:kpiResult:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> BaseKpiResult
$sel:nextToken:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BaseKpiResult
kpiResult
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
kpiName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
journeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId

instance Prelude.NFData JourneyDateRangeKpiResponse where
  rnf :: JourneyDateRangeKpiResponse -> ()
rnf JourneyDateRangeKpiResponse' {Maybe Text
Text
ISO8601
BaseKpiResult
applicationId :: Text
startTime :: ISO8601
endTime :: ISO8601
journeyId :: Text
kpiName :: Text
kpiResult :: BaseKpiResult
nextToken :: Maybe Text
$sel:applicationId:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> Text
$sel:startTime:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> ISO8601
$sel:endTime:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> ISO8601
$sel:journeyId:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> Text
$sel:kpiName:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> Text
$sel:kpiResult:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> BaseKpiResult
$sel:nextToken:JourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf BaseKpiResult
kpiResult
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
kpiName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
journeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId