{-# 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.Personalize.Types.MetricAttributionSummary
-- 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.Personalize.Types.MetricAttributionSummary where

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

-- | Provides a summary of the properties of a metric attribution. For a
-- complete listing, call the
-- <https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeMetricAttribution.html DescribeMetricAttribution>.
--
-- /See:/ 'newMetricAttributionSummary' smart constructor.
data MetricAttributionSummary = MetricAttributionSummary'
  { -- | The metric attribution\'s creation date time.
    MetricAttributionSummary -> Maybe POSIX
creationDateTime :: Prelude.Maybe Data.POSIX,
    -- | The metric attribution\'s failure reason.
    MetricAttributionSummary -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The metric attribution\'s last updated date time.
    MetricAttributionSummary -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Data.POSIX,
    -- | The metric attribution\'s Amazon Resource Name (ARN).
    MetricAttributionSummary -> Maybe Text
metricAttributionArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the metric attribution.
    MetricAttributionSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The metric attribution\'s status.
    MetricAttributionSummary -> Maybe Text
status :: Prelude.Maybe Prelude.Text
  }
  deriving (MetricAttributionSummary -> MetricAttributionSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricAttributionSummary -> MetricAttributionSummary -> Bool
$c/= :: MetricAttributionSummary -> MetricAttributionSummary -> Bool
== :: MetricAttributionSummary -> MetricAttributionSummary -> Bool
$c== :: MetricAttributionSummary -> MetricAttributionSummary -> Bool
Prelude.Eq, ReadPrec [MetricAttributionSummary]
ReadPrec MetricAttributionSummary
Int -> ReadS MetricAttributionSummary
ReadS [MetricAttributionSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetricAttributionSummary]
$creadListPrec :: ReadPrec [MetricAttributionSummary]
readPrec :: ReadPrec MetricAttributionSummary
$creadPrec :: ReadPrec MetricAttributionSummary
readList :: ReadS [MetricAttributionSummary]
$creadList :: ReadS [MetricAttributionSummary]
readsPrec :: Int -> ReadS MetricAttributionSummary
$creadsPrec :: Int -> ReadS MetricAttributionSummary
Prelude.Read, Int -> MetricAttributionSummary -> ShowS
[MetricAttributionSummary] -> ShowS
MetricAttributionSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricAttributionSummary] -> ShowS
$cshowList :: [MetricAttributionSummary] -> ShowS
show :: MetricAttributionSummary -> String
$cshow :: MetricAttributionSummary -> String
showsPrec :: Int -> MetricAttributionSummary -> ShowS
$cshowsPrec :: Int -> MetricAttributionSummary -> ShowS
Prelude.Show, forall x.
Rep MetricAttributionSummary x -> MetricAttributionSummary
forall x.
MetricAttributionSummary -> Rep MetricAttributionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MetricAttributionSummary x -> MetricAttributionSummary
$cfrom :: forall x.
MetricAttributionSummary -> Rep MetricAttributionSummary x
Prelude.Generic)

-- |
-- Create a value of 'MetricAttributionSummary' 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:
--
-- 'creationDateTime', 'metricAttributionSummary_creationDateTime' - The metric attribution\'s creation date time.
--
-- 'failureReason', 'metricAttributionSummary_failureReason' - The metric attribution\'s failure reason.
--
-- 'lastUpdatedDateTime', 'metricAttributionSummary_lastUpdatedDateTime' - The metric attribution\'s last updated date time.
--
-- 'metricAttributionArn', 'metricAttributionSummary_metricAttributionArn' - The metric attribution\'s Amazon Resource Name (ARN).
--
-- 'name', 'metricAttributionSummary_name' - The name of the metric attribution.
--
-- 'status', 'metricAttributionSummary_status' - The metric attribution\'s status.
newMetricAttributionSummary ::
  MetricAttributionSummary
newMetricAttributionSummary :: MetricAttributionSummary
newMetricAttributionSummary =
  MetricAttributionSummary'
    { $sel:creationDateTime:MetricAttributionSummary' :: Maybe POSIX
creationDateTime =
        forall a. Maybe a
Prelude.Nothing,
      $sel:failureReason:MetricAttributionSummary' :: Maybe Text
failureReason = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:MetricAttributionSummary' :: Maybe POSIX
lastUpdatedDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:metricAttributionArn:MetricAttributionSummary' :: Maybe Text
metricAttributionArn = forall a. Maybe a
Prelude.Nothing,
      $sel:name:MetricAttributionSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:status:MetricAttributionSummary' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The metric attribution\'s creation date time.
metricAttributionSummary_creationDateTime :: Lens.Lens' MetricAttributionSummary (Prelude.Maybe Prelude.UTCTime)
metricAttributionSummary_creationDateTime :: Lens' MetricAttributionSummary (Maybe UTCTime)
metricAttributionSummary_creationDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricAttributionSummary' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: MetricAttributionSummary
s@MetricAttributionSummary' {} Maybe POSIX
a -> MetricAttributionSummary
s {$sel:creationDateTime:MetricAttributionSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: MetricAttributionSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The metric attribution\'s failure reason.
metricAttributionSummary_failureReason :: Lens.Lens' MetricAttributionSummary (Prelude.Maybe Prelude.Text)
metricAttributionSummary_failureReason :: Lens' MetricAttributionSummary (Maybe Text)
metricAttributionSummary_failureReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricAttributionSummary' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: MetricAttributionSummary
s@MetricAttributionSummary' {} Maybe Text
a -> MetricAttributionSummary
s {$sel:failureReason:MetricAttributionSummary' :: Maybe Text
failureReason = Maybe Text
a} :: MetricAttributionSummary)

-- | The metric attribution\'s last updated date time.
metricAttributionSummary_lastUpdatedDateTime :: Lens.Lens' MetricAttributionSummary (Prelude.Maybe Prelude.UTCTime)
metricAttributionSummary_lastUpdatedDateTime :: Lens' MetricAttributionSummary (Maybe UTCTime)
metricAttributionSummary_lastUpdatedDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricAttributionSummary' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: MetricAttributionSummary
s@MetricAttributionSummary' {} Maybe POSIX
a -> MetricAttributionSummary
s {$sel:lastUpdatedDateTime:MetricAttributionSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: MetricAttributionSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The metric attribution\'s Amazon Resource Name (ARN).
metricAttributionSummary_metricAttributionArn :: Lens.Lens' MetricAttributionSummary (Prelude.Maybe Prelude.Text)
metricAttributionSummary_metricAttributionArn :: Lens' MetricAttributionSummary (Maybe Text)
metricAttributionSummary_metricAttributionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricAttributionSummary' {Maybe Text
metricAttributionArn :: Maybe Text
$sel:metricAttributionArn:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
metricAttributionArn} -> Maybe Text
metricAttributionArn) (\s :: MetricAttributionSummary
s@MetricAttributionSummary' {} Maybe Text
a -> MetricAttributionSummary
s {$sel:metricAttributionArn:MetricAttributionSummary' :: Maybe Text
metricAttributionArn = Maybe Text
a} :: MetricAttributionSummary)

-- | The name of the metric attribution.
metricAttributionSummary_name :: Lens.Lens' MetricAttributionSummary (Prelude.Maybe Prelude.Text)
metricAttributionSummary_name :: Lens' MetricAttributionSummary (Maybe Text)
metricAttributionSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricAttributionSummary' {Maybe Text
name :: Maybe Text
$sel:name:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: MetricAttributionSummary
s@MetricAttributionSummary' {} Maybe Text
a -> MetricAttributionSummary
s {$sel:name:MetricAttributionSummary' :: Maybe Text
name = Maybe Text
a} :: MetricAttributionSummary)

-- | The metric attribution\'s status.
metricAttributionSummary_status :: Lens.Lens' MetricAttributionSummary (Prelude.Maybe Prelude.Text)
metricAttributionSummary_status :: Lens' MetricAttributionSummary (Maybe Text)
metricAttributionSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricAttributionSummary' {Maybe Text
status :: Maybe Text
$sel:status:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
status} -> Maybe Text
status) (\s :: MetricAttributionSummary
s@MetricAttributionSummary' {} Maybe Text
a -> MetricAttributionSummary
s {$sel:status:MetricAttributionSummary' :: Maybe Text
status = Maybe Text
a} :: MetricAttributionSummary)

instance Data.FromJSON MetricAttributionSummary where
  parseJSON :: Value -> Parser MetricAttributionSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MetricAttributionSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> MetricAttributionSummary
MetricAttributionSummary'
            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
"creationDateTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"failureReason")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lastUpdatedDateTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"metricAttributionArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"status")
      )

instance Prelude.Hashable MetricAttributionSummary where
  hashWithSalt :: Int -> MetricAttributionSummary -> Int
hashWithSalt Int
_salt MetricAttributionSummary' {Maybe Text
Maybe POSIX
status :: Maybe Text
name :: Maybe Text
metricAttributionArn :: Maybe Text
lastUpdatedDateTime :: Maybe POSIX
failureReason :: Maybe Text
creationDateTime :: Maybe POSIX
$sel:status:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
$sel:name:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
$sel:metricAttributionArn:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
$sel:lastUpdatedDateTime:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe POSIX
$sel:failureReason:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
$sel:creationDateTime:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
failureReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
metricAttributionArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status

instance Prelude.NFData MetricAttributionSummary where
  rnf :: MetricAttributionSummary -> ()
rnf MetricAttributionSummary' {Maybe Text
Maybe POSIX
status :: Maybe Text
name :: Maybe Text
metricAttributionArn :: Maybe Text
lastUpdatedDateTime :: Maybe POSIX
failureReason :: Maybe Text
creationDateTime :: Maybe POSIX
$sel:status:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
$sel:name:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
$sel:metricAttributionArn:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
$sel:lastUpdatedDateTime:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe POSIX
$sel:failureReason:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe Text
$sel:creationDateTime:MetricAttributionSummary' :: MetricAttributionSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
failureReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metricAttributionArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status