{-# 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.ApplicationDateRangeKpiResponse
-- 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.ApplicationDateRangeKpiResponse 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
-- metric that applies to an application, and provides information about
-- that query.
--
-- /See:/ 'newApplicationDateRangeKpiResponse' smart constructor.
data ApplicationDateRangeKpiResponse = ApplicationDateRangeKpiResponse'
  { -- | 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 Application
    -- Metrics resource because the resource returns all results in a single
    -- page.
    ApplicationDateRangeKpiResponse -> 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.
    ApplicationDateRangeKpiResponse -> 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>.
    ApplicationDateRangeKpiResponse -> Text
kpiName :: 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.
    ApplicationDateRangeKpiResponse -> 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.
    ApplicationDateRangeKpiResponse -> ISO8601
startTime :: Data.ISO8601,
    -- | The unique identifier for the application that the metric applies to.
    ApplicationDateRangeKpiResponse -> Text
applicationId :: Prelude.Text
  }
  deriving (ApplicationDateRangeKpiResponse
-> ApplicationDateRangeKpiResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationDateRangeKpiResponse
-> ApplicationDateRangeKpiResponse -> Bool
$c/= :: ApplicationDateRangeKpiResponse
-> ApplicationDateRangeKpiResponse -> Bool
== :: ApplicationDateRangeKpiResponse
-> ApplicationDateRangeKpiResponse -> Bool
$c== :: ApplicationDateRangeKpiResponse
-> ApplicationDateRangeKpiResponse -> Bool
Prelude.Eq, ReadPrec [ApplicationDateRangeKpiResponse]
ReadPrec ApplicationDateRangeKpiResponse
Int -> ReadS ApplicationDateRangeKpiResponse
ReadS [ApplicationDateRangeKpiResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationDateRangeKpiResponse]
$creadListPrec :: ReadPrec [ApplicationDateRangeKpiResponse]
readPrec :: ReadPrec ApplicationDateRangeKpiResponse
$creadPrec :: ReadPrec ApplicationDateRangeKpiResponse
readList :: ReadS [ApplicationDateRangeKpiResponse]
$creadList :: ReadS [ApplicationDateRangeKpiResponse]
readsPrec :: Int -> ReadS ApplicationDateRangeKpiResponse
$creadsPrec :: Int -> ReadS ApplicationDateRangeKpiResponse
Prelude.Read, Int -> ApplicationDateRangeKpiResponse -> ShowS
[ApplicationDateRangeKpiResponse] -> ShowS
ApplicationDateRangeKpiResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationDateRangeKpiResponse] -> ShowS
$cshowList :: [ApplicationDateRangeKpiResponse] -> ShowS
show :: ApplicationDateRangeKpiResponse -> String
$cshow :: ApplicationDateRangeKpiResponse -> String
showsPrec :: Int -> ApplicationDateRangeKpiResponse -> ShowS
$cshowsPrec :: Int -> ApplicationDateRangeKpiResponse -> ShowS
Prelude.Show, forall x.
Rep ApplicationDateRangeKpiResponse x
-> ApplicationDateRangeKpiResponse
forall x.
ApplicationDateRangeKpiResponse
-> Rep ApplicationDateRangeKpiResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ApplicationDateRangeKpiResponse x
-> ApplicationDateRangeKpiResponse
$cfrom :: forall x.
ApplicationDateRangeKpiResponse
-> Rep ApplicationDateRangeKpiResponse x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationDateRangeKpiResponse' 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', 'applicationDateRangeKpiResponse_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 Application
-- Metrics resource because the resource returns all results in a single
-- page.
--
-- 'kpiResult', 'applicationDateRangeKpiResponse_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', 'applicationDateRangeKpiResponse_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>.
--
-- 'endTime', 'applicationDateRangeKpiResponse_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', 'applicationDateRangeKpiResponse_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', 'applicationDateRangeKpiResponse_applicationId' - The unique identifier for the application that the metric applies to.
newApplicationDateRangeKpiResponse ::
  -- | 'kpiResult'
  BaseKpiResult ->
  -- | 'kpiName'
  Prelude.Text ->
  -- | 'endTime'
  Prelude.UTCTime ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'applicationId'
  Prelude.Text ->
  ApplicationDateRangeKpiResponse
newApplicationDateRangeKpiResponse :: BaseKpiResult
-> Text
-> UTCTime
-> UTCTime
-> Text
-> ApplicationDateRangeKpiResponse
newApplicationDateRangeKpiResponse
  BaseKpiResult
pKpiResult_
  Text
pKpiName_
  UTCTime
pEndTime_
  UTCTime
pStartTime_
  Text
pApplicationId_ =
    ApplicationDateRangeKpiResponse'
      { $sel:nextToken:ApplicationDateRangeKpiResponse' :: Maybe Text
nextToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:kpiResult:ApplicationDateRangeKpiResponse' :: BaseKpiResult
kpiResult = BaseKpiResult
pKpiResult_,
        $sel:kpiName:ApplicationDateRangeKpiResponse' :: Text
kpiName = Text
pKpiName_,
        $sel:endTime:ApplicationDateRangeKpiResponse' :: ISO8601
endTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_,
        $sel:startTime:ApplicationDateRangeKpiResponse' :: ISO8601
startTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:applicationId:ApplicationDateRangeKpiResponse' :: 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 Application
-- Metrics resource because the resource returns all results in a single
-- page.
applicationDateRangeKpiResponse_nextToken :: Lens.Lens' ApplicationDateRangeKpiResponse (Prelude.Maybe Prelude.Text)
applicationDateRangeKpiResponse_nextToken :: Lens' ApplicationDateRangeKpiResponse (Maybe Text)
applicationDateRangeKpiResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationDateRangeKpiResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ApplicationDateRangeKpiResponse
s@ApplicationDateRangeKpiResponse' {} Maybe Text
a -> ApplicationDateRangeKpiResponse
s {$sel:nextToken:ApplicationDateRangeKpiResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ApplicationDateRangeKpiResponse)

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

-- | 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>.
applicationDateRangeKpiResponse_kpiName :: Lens.Lens' ApplicationDateRangeKpiResponse Prelude.Text
applicationDateRangeKpiResponse_kpiName :: Lens' ApplicationDateRangeKpiResponse Text
applicationDateRangeKpiResponse_kpiName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationDateRangeKpiResponse' {Text
kpiName :: Text
$sel:kpiName:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> Text
kpiName} -> Text
kpiName) (\s :: ApplicationDateRangeKpiResponse
s@ApplicationDateRangeKpiResponse' {} Text
a -> ApplicationDateRangeKpiResponse
s {$sel:kpiName:ApplicationDateRangeKpiResponse' :: Text
kpiName = Text
a} :: ApplicationDateRangeKpiResponse)

-- | 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.
applicationDateRangeKpiResponse_endTime :: Lens.Lens' ApplicationDateRangeKpiResponse Prelude.UTCTime
applicationDateRangeKpiResponse_endTime :: Lens' ApplicationDateRangeKpiResponse UTCTime
applicationDateRangeKpiResponse_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationDateRangeKpiResponse' {ISO8601
endTime :: ISO8601
$sel:endTime:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> ISO8601
endTime} -> ISO8601
endTime) (\s :: ApplicationDateRangeKpiResponse
s@ApplicationDateRangeKpiResponse' {} ISO8601
a -> ApplicationDateRangeKpiResponse
s {$sel:endTime:ApplicationDateRangeKpiResponse' :: ISO8601
endTime = ISO8601
a} :: ApplicationDateRangeKpiResponse) 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.
applicationDateRangeKpiResponse_startTime :: Lens.Lens' ApplicationDateRangeKpiResponse Prelude.UTCTime
applicationDateRangeKpiResponse_startTime :: Lens' ApplicationDateRangeKpiResponse UTCTime
applicationDateRangeKpiResponse_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationDateRangeKpiResponse' {ISO8601
startTime :: ISO8601
$sel:startTime:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> ISO8601
startTime} -> ISO8601
startTime) (\s :: ApplicationDateRangeKpiResponse
s@ApplicationDateRangeKpiResponse' {} ISO8601
a -> ApplicationDateRangeKpiResponse
s {$sel:startTime:ApplicationDateRangeKpiResponse' :: ISO8601
startTime = ISO8601
a} :: ApplicationDateRangeKpiResponse) 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.
applicationDateRangeKpiResponse_applicationId :: Lens.Lens' ApplicationDateRangeKpiResponse Prelude.Text
applicationDateRangeKpiResponse_applicationId :: Lens' ApplicationDateRangeKpiResponse Text
applicationDateRangeKpiResponse_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationDateRangeKpiResponse' {Text
applicationId :: Text
$sel:applicationId:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> Text
applicationId} -> Text
applicationId) (\s :: ApplicationDateRangeKpiResponse
s@ApplicationDateRangeKpiResponse' {} Text
a -> ApplicationDateRangeKpiResponse
s {$sel:applicationId:ApplicationDateRangeKpiResponse' :: Text
applicationId = Text
a} :: ApplicationDateRangeKpiResponse)

instance
  Data.FromJSON
    ApplicationDateRangeKpiResponse
  where
  parseJSON :: Value -> Parser ApplicationDateRangeKpiResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ApplicationDateRangeKpiResponse"
      ( \Object
x ->
          Maybe Text
-> BaseKpiResult
-> Text
-> ISO8601
-> ISO8601
-> Text
-> ApplicationDateRangeKpiResponse
ApplicationDateRangeKpiResponse'
            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
"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
    ApplicationDateRangeKpiResponse
  where
  hashWithSalt :: Int -> ApplicationDateRangeKpiResponse -> Int
hashWithSalt
    Int
_salt
    ApplicationDateRangeKpiResponse' {Maybe Text
Text
ISO8601
BaseKpiResult
applicationId :: Text
startTime :: ISO8601
endTime :: ISO8601
kpiName :: Text
kpiResult :: BaseKpiResult
nextToken :: Maybe Text
$sel:applicationId:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> Text
$sel:startTime:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> ISO8601
$sel:endTime:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> ISO8601
$sel:kpiName:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> Text
$sel:kpiResult:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> BaseKpiResult
$sel:nextToken:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> 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` 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
    ApplicationDateRangeKpiResponse
  where
  rnf :: ApplicationDateRangeKpiResponse -> ()
rnf ApplicationDateRangeKpiResponse' {Maybe Text
Text
ISO8601
BaseKpiResult
applicationId :: Text
startTime :: ISO8601
endTime :: ISO8601
kpiName :: Text
kpiResult :: BaseKpiResult
nextToken :: Maybe Text
$sel:applicationId:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> Text
$sel:startTime:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> ISO8601
$sel:endTime:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> ISO8601
$sel:kpiName:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> Text
$sel:kpiResult:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> BaseKpiResult
$sel:nextToken:ApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse -> 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 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