{-# 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.LookoutMetrics.Types.AnomalyGroupSummary
-- 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.LookoutMetrics.Types.AnomalyGroupSummary 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

-- | Details about a group of anomalous metrics.
--
-- /See:/ 'newAnomalyGroupSummary' smart constructor.
data AnomalyGroupSummary = AnomalyGroupSummary'
  { -- | The ID of the anomaly group.
    AnomalyGroupSummary -> Maybe Text
anomalyGroupId :: Prelude.Maybe Prelude.Text,
    -- | The severity score of the group.
    AnomalyGroupSummary -> Maybe Double
anomalyGroupScore :: Prelude.Maybe Prelude.Double,
    -- | The end time for the group.
    AnomalyGroupSummary -> Maybe Text
endTime :: Prelude.Maybe Prelude.Text,
    -- | The name of the primary affected measure for the group.
    AnomalyGroupSummary -> Maybe Text
primaryMetricName :: Prelude.Maybe Prelude.Text,
    -- | The start time for the group.
    AnomalyGroupSummary -> Maybe Text
startTime :: Prelude.Maybe Prelude.Text
  }
  deriving (AnomalyGroupSummary -> AnomalyGroupSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalyGroupSummary -> AnomalyGroupSummary -> Bool
$c/= :: AnomalyGroupSummary -> AnomalyGroupSummary -> Bool
== :: AnomalyGroupSummary -> AnomalyGroupSummary -> Bool
$c== :: AnomalyGroupSummary -> AnomalyGroupSummary -> Bool
Prelude.Eq, ReadPrec [AnomalyGroupSummary]
ReadPrec AnomalyGroupSummary
Int -> ReadS AnomalyGroupSummary
ReadS [AnomalyGroupSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalyGroupSummary]
$creadListPrec :: ReadPrec [AnomalyGroupSummary]
readPrec :: ReadPrec AnomalyGroupSummary
$creadPrec :: ReadPrec AnomalyGroupSummary
readList :: ReadS [AnomalyGroupSummary]
$creadList :: ReadS [AnomalyGroupSummary]
readsPrec :: Int -> ReadS AnomalyGroupSummary
$creadsPrec :: Int -> ReadS AnomalyGroupSummary
Prelude.Read, Int -> AnomalyGroupSummary -> ShowS
[AnomalyGroupSummary] -> ShowS
AnomalyGroupSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalyGroupSummary] -> ShowS
$cshowList :: [AnomalyGroupSummary] -> ShowS
show :: AnomalyGroupSummary -> String
$cshow :: AnomalyGroupSummary -> String
showsPrec :: Int -> AnomalyGroupSummary -> ShowS
$cshowsPrec :: Int -> AnomalyGroupSummary -> ShowS
Prelude.Show, forall x. Rep AnomalyGroupSummary x -> AnomalyGroupSummary
forall x. AnomalyGroupSummary -> Rep AnomalyGroupSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnomalyGroupSummary x -> AnomalyGroupSummary
$cfrom :: forall x. AnomalyGroupSummary -> Rep AnomalyGroupSummary x
Prelude.Generic)

-- |
-- Create a value of 'AnomalyGroupSummary' 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:
--
-- 'anomalyGroupId', 'anomalyGroupSummary_anomalyGroupId' - The ID of the anomaly group.
--
-- 'anomalyGroupScore', 'anomalyGroupSummary_anomalyGroupScore' - The severity score of the group.
--
-- 'endTime', 'anomalyGroupSummary_endTime' - The end time for the group.
--
-- 'primaryMetricName', 'anomalyGroupSummary_primaryMetricName' - The name of the primary affected measure for the group.
--
-- 'startTime', 'anomalyGroupSummary_startTime' - The start time for the group.
newAnomalyGroupSummary ::
  AnomalyGroupSummary
newAnomalyGroupSummary :: AnomalyGroupSummary
newAnomalyGroupSummary =
  AnomalyGroupSummary'
    { $sel:anomalyGroupId:AnomalyGroupSummary' :: Maybe Text
anomalyGroupId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:anomalyGroupScore:AnomalyGroupSummary' :: Maybe Double
anomalyGroupScore = forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:AnomalyGroupSummary' :: Maybe Text
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:primaryMetricName:AnomalyGroupSummary' :: Maybe Text
primaryMetricName = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:AnomalyGroupSummary' :: Maybe Text
startTime = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the anomaly group.
anomalyGroupSummary_anomalyGroupId :: Lens.Lens' AnomalyGroupSummary (Prelude.Maybe Prelude.Text)
anomalyGroupSummary_anomalyGroupId :: Lens' AnomalyGroupSummary (Maybe Text)
anomalyGroupSummary_anomalyGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupSummary' {Maybe Text
anomalyGroupId :: Maybe Text
$sel:anomalyGroupId:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
anomalyGroupId} -> Maybe Text
anomalyGroupId) (\s :: AnomalyGroupSummary
s@AnomalyGroupSummary' {} Maybe Text
a -> AnomalyGroupSummary
s {$sel:anomalyGroupId:AnomalyGroupSummary' :: Maybe Text
anomalyGroupId = Maybe Text
a} :: AnomalyGroupSummary)

-- | The severity score of the group.
anomalyGroupSummary_anomalyGroupScore :: Lens.Lens' AnomalyGroupSummary (Prelude.Maybe Prelude.Double)
anomalyGroupSummary_anomalyGroupScore :: Lens' AnomalyGroupSummary (Maybe Double)
anomalyGroupSummary_anomalyGroupScore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupSummary' {Maybe Double
anomalyGroupScore :: Maybe Double
$sel:anomalyGroupScore:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Double
anomalyGroupScore} -> Maybe Double
anomalyGroupScore) (\s :: AnomalyGroupSummary
s@AnomalyGroupSummary' {} Maybe Double
a -> AnomalyGroupSummary
s {$sel:anomalyGroupScore:AnomalyGroupSummary' :: Maybe Double
anomalyGroupScore = Maybe Double
a} :: AnomalyGroupSummary)

-- | The end time for the group.
anomalyGroupSummary_endTime :: Lens.Lens' AnomalyGroupSummary (Prelude.Maybe Prelude.Text)
anomalyGroupSummary_endTime :: Lens' AnomalyGroupSummary (Maybe Text)
anomalyGroupSummary_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupSummary' {Maybe Text
endTime :: Maybe Text
$sel:endTime:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
endTime} -> Maybe Text
endTime) (\s :: AnomalyGroupSummary
s@AnomalyGroupSummary' {} Maybe Text
a -> AnomalyGroupSummary
s {$sel:endTime:AnomalyGroupSummary' :: Maybe Text
endTime = Maybe Text
a} :: AnomalyGroupSummary)

-- | The name of the primary affected measure for the group.
anomalyGroupSummary_primaryMetricName :: Lens.Lens' AnomalyGroupSummary (Prelude.Maybe Prelude.Text)
anomalyGroupSummary_primaryMetricName :: Lens' AnomalyGroupSummary (Maybe Text)
anomalyGroupSummary_primaryMetricName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupSummary' {Maybe Text
primaryMetricName :: Maybe Text
$sel:primaryMetricName:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
primaryMetricName} -> Maybe Text
primaryMetricName) (\s :: AnomalyGroupSummary
s@AnomalyGroupSummary' {} Maybe Text
a -> AnomalyGroupSummary
s {$sel:primaryMetricName:AnomalyGroupSummary' :: Maybe Text
primaryMetricName = Maybe Text
a} :: AnomalyGroupSummary)

-- | The start time for the group.
anomalyGroupSummary_startTime :: Lens.Lens' AnomalyGroupSummary (Prelude.Maybe Prelude.Text)
anomalyGroupSummary_startTime :: Lens' AnomalyGroupSummary (Maybe Text)
anomalyGroupSummary_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupSummary' {Maybe Text
startTime :: Maybe Text
$sel:startTime:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
startTime} -> Maybe Text
startTime) (\s :: AnomalyGroupSummary
s@AnomalyGroupSummary' {} Maybe Text
a -> AnomalyGroupSummary
s {$sel:startTime:AnomalyGroupSummary' :: Maybe Text
startTime = Maybe Text
a} :: AnomalyGroupSummary)

instance Data.FromJSON AnomalyGroupSummary where
  parseJSON :: Value -> Parser AnomalyGroupSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AnomalyGroupSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Double
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AnomalyGroupSummary
AnomalyGroupSummary'
            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
"AnomalyGroupId")
            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
"AnomalyGroupScore")
            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
"EndTime")
            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
"PrimaryMetricName")
            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
"StartTime")
      )

instance Prelude.Hashable AnomalyGroupSummary where
  hashWithSalt :: Int -> AnomalyGroupSummary -> Int
hashWithSalt Int
_salt AnomalyGroupSummary' {Maybe Double
Maybe Text
startTime :: Maybe Text
primaryMetricName :: Maybe Text
endTime :: Maybe Text
anomalyGroupScore :: Maybe Double
anomalyGroupId :: Maybe Text
$sel:startTime:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
$sel:primaryMetricName:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
$sel:endTime:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
$sel:anomalyGroupScore:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Double
$sel:anomalyGroupId:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
anomalyGroupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
anomalyGroupScore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
primaryMetricName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
startTime

instance Prelude.NFData AnomalyGroupSummary where
  rnf :: AnomalyGroupSummary -> ()
rnf AnomalyGroupSummary' {Maybe Double
Maybe Text
startTime :: Maybe Text
primaryMetricName :: Maybe Text
endTime :: Maybe Text
anomalyGroupScore :: Maybe Double
anomalyGroupId :: Maybe Text
$sel:startTime:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
$sel:primaryMetricName:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
$sel:endTime:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
$sel:anomalyGroupScore:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Double
$sel:anomalyGroupId:AnomalyGroupSummary' :: AnomalyGroupSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
anomalyGroupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
anomalyGroupScore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
primaryMetricName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
startTime