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

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

-- | Feedback for an anomalous metric.
--
-- /See:/ 'newAnomalyGroupTimeSeriesFeedback' smart constructor.
data AnomalyGroupTimeSeriesFeedback = AnomalyGroupTimeSeriesFeedback'
  { -- | The ID of the anomaly group.
    AnomalyGroupTimeSeriesFeedback -> Text
anomalyGroupId :: Prelude.Text,
    -- | The ID of the metric.
    AnomalyGroupTimeSeriesFeedback -> Text
timeSeriesId :: Prelude.Text,
    -- | Feedback on whether the metric is a legitimate anomaly.
    AnomalyGroupTimeSeriesFeedback -> Bool
isAnomaly :: Prelude.Bool
  }
  deriving (AnomalyGroupTimeSeriesFeedback
-> AnomalyGroupTimeSeriesFeedback -> Bool
(AnomalyGroupTimeSeriesFeedback
 -> AnomalyGroupTimeSeriesFeedback -> Bool)
-> (AnomalyGroupTimeSeriesFeedback
    -> AnomalyGroupTimeSeriesFeedback -> Bool)
-> Eq AnomalyGroupTimeSeriesFeedback
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalyGroupTimeSeriesFeedback
-> AnomalyGroupTimeSeriesFeedback -> Bool
$c/= :: AnomalyGroupTimeSeriesFeedback
-> AnomalyGroupTimeSeriesFeedback -> Bool
== :: AnomalyGroupTimeSeriesFeedback
-> AnomalyGroupTimeSeriesFeedback -> Bool
$c== :: AnomalyGroupTimeSeriesFeedback
-> AnomalyGroupTimeSeriesFeedback -> Bool
Prelude.Eq, ReadPrec [AnomalyGroupTimeSeriesFeedback]
ReadPrec AnomalyGroupTimeSeriesFeedback
Int -> ReadS AnomalyGroupTimeSeriesFeedback
ReadS [AnomalyGroupTimeSeriesFeedback]
(Int -> ReadS AnomalyGroupTimeSeriesFeedback)
-> ReadS [AnomalyGroupTimeSeriesFeedback]
-> ReadPrec AnomalyGroupTimeSeriesFeedback
-> ReadPrec [AnomalyGroupTimeSeriesFeedback]
-> Read AnomalyGroupTimeSeriesFeedback
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalyGroupTimeSeriesFeedback]
$creadListPrec :: ReadPrec [AnomalyGroupTimeSeriesFeedback]
readPrec :: ReadPrec AnomalyGroupTimeSeriesFeedback
$creadPrec :: ReadPrec AnomalyGroupTimeSeriesFeedback
readList :: ReadS [AnomalyGroupTimeSeriesFeedback]
$creadList :: ReadS [AnomalyGroupTimeSeriesFeedback]
readsPrec :: Int -> ReadS AnomalyGroupTimeSeriesFeedback
$creadsPrec :: Int -> ReadS AnomalyGroupTimeSeriesFeedback
Prelude.Read, Int -> AnomalyGroupTimeSeriesFeedback -> ShowS
[AnomalyGroupTimeSeriesFeedback] -> ShowS
AnomalyGroupTimeSeriesFeedback -> String
(Int -> AnomalyGroupTimeSeriesFeedback -> ShowS)
-> (AnomalyGroupTimeSeriesFeedback -> String)
-> ([AnomalyGroupTimeSeriesFeedback] -> ShowS)
-> Show AnomalyGroupTimeSeriesFeedback
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalyGroupTimeSeriesFeedback] -> ShowS
$cshowList :: [AnomalyGroupTimeSeriesFeedback] -> ShowS
show :: AnomalyGroupTimeSeriesFeedback -> String
$cshow :: AnomalyGroupTimeSeriesFeedback -> String
showsPrec :: Int -> AnomalyGroupTimeSeriesFeedback -> ShowS
$cshowsPrec :: Int -> AnomalyGroupTimeSeriesFeedback -> ShowS
Prelude.Show, (forall x.
 AnomalyGroupTimeSeriesFeedback
 -> Rep AnomalyGroupTimeSeriesFeedback x)
-> (forall x.
    Rep AnomalyGroupTimeSeriesFeedback x
    -> AnomalyGroupTimeSeriesFeedback)
-> Generic AnomalyGroupTimeSeriesFeedback
forall x.
Rep AnomalyGroupTimeSeriesFeedback x
-> AnomalyGroupTimeSeriesFeedback
forall x.
AnomalyGroupTimeSeriesFeedback
-> Rep AnomalyGroupTimeSeriesFeedback x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AnomalyGroupTimeSeriesFeedback x
-> AnomalyGroupTimeSeriesFeedback
$cfrom :: forall x.
AnomalyGroupTimeSeriesFeedback
-> Rep AnomalyGroupTimeSeriesFeedback x
Prelude.Generic)

-- |
-- Create a value of 'AnomalyGroupTimeSeriesFeedback' 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', 'anomalyGroupTimeSeriesFeedback_anomalyGroupId' - The ID of the anomaly group.
--
-- 'timeSeriesId', 'anomalyGroupTimeSeriesFeedback_timeSeriesId' - The ID of the metric.
--
-- 'isAnomaly', 'anomalyGroupTimeSeriesFeedback_isAnomaly' - Feedback on whether the metric is a legitimate anomaly.
newAnomalyGroupTimeSeriesFeedback ::
  -- | 'anomalyGroupId'
  Prelude.Text ->
  -- | 'timeSeriesId'
  Prelude.Text ->
  -- | 'isAnomaly'
  Prelude.Bool ->
  AnomalyGroupTimeSeriesFeedback
newAnomalyGroupTimeSeriesFeedback :: Text -> Text -> Bool -> AnomalyGroupTimeSeriesFeedback
newAnomalyGroupTimeSeriesFeedback
  Text
pAnomalyGroupId_
  Text
pTimeSeriesId_
  Bool
pIsAnomaly_ =
    AnomalyGroupTimeSeriesFeedback' :: Text -> Text -> Bool -> AnomalyGroupTimeSeriesFeedback
AnomalyGroupTimeSeriesFeedback'
      { $sel:anomalyGroupId:AnomalyGroupTimeSeriesFeedback' :: Text
anomalyGroupId =
          Text
pAnomalyGroupId_,
        $sel:timeSeriesId:AnomalyGroupTimeSeriesFeedback' :: Text
timeSeriesId = Text
pTimeSeriesId_,
        $sel:isAnomaly:AnomalyGroupTimeSeriesFeedback' :: Bool
isAnomaly = Bool
pIsAnomaly_
      }

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

-- | The ID of the metric.
anomalyGroupTimeSeriesFeedback_timeSeriesId :: Lens.Lens' AnomalyGroupTimeSeriesFeedback Prelude.Text
anomalyGroupTimeSeriesFeedback_timeSeriesId :: (Text -> f Text)
-> AnomalyGroupTimeSeriesFeedback
-> f AnomalyGroupTimeSeriesFeedback
anomalyGroupTimeSeriesFeedback_timeSeriesId = (AnomalyGroupTimeSeriesFeedback -> Text)
-> (AnomalyGroupTimeSeriesFeedback
    -> Text -> AnomalyGroupTimeSeriesFeedback)
-> Lens
     AnomalyGroupTimeSeriesFeedback
     AnomalyGroupTimeSeriesFeedback
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupTimeSeriesFeedback' {Text
timeSeriesId :: Text
$sel:timeSeriesId:AnomalyGroupTimeSeriesFeedback' :: AnomalyGroupTimeSeriesFeedback -> Text
timeSeriesId} -> Text
timeSeriesId) (\s :: AnomalyGroupTimeSeriesFeedback
s@AnomalyGroupTimeSeriesFeedback' {} Text
a -> AnomalyGroupTimeSeriesFeedback
s {$sel:timeSeriesId:AnomalyGroupTimeSeriesFeedback' :: Text
timeSeriesId = Text
a} :: AnomalyGroupTimeSeriesFeedback)

-- | Feedback on whether the metric is a legitimate anomaly.
anomalyGroupTimeSeriesFeedback_isAnomaly :: Lens.Lens' AnomalyGroupTimeSeriesFeedback Prelude.Bool
anomalyGroupTimeSeriesFeedback_isAnomaly :: (Bool -> f Bool)
-> AnomalyGroupTimeSeriesFeedback
-> f AnomalyGroupTimeSeriesFeedback
anomalyGroupTimeSeriesFeedback_isAnomaly = (AnomalyGroupTimeSeriesFeedback -> Bool)
-> (AnomalyGroupTimeSeriesFeedback
    -> Bool -> AnomalyGroupTimeSeriesFeedback)
-> Lens
     AnomalyGroupTimeSeriesFeedback
     AnomalyGroupTimeSeriesFeedback
     Bool
     Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyGroupTimeSeriesFeedback' {Bool
isAnomaly :: Bool
$sel:isAnomaly:AnomalyGroupTimeSeriesFeedback' :: AnomalyGroupTimeSeriesFeedback -> Bool
isAnomaly} -> Bool
isAnomaly) (\s :: AnomalyGroupTimeSeriesFeedback
s@AnomalyGroupTimeSeriesFeedback' {} Bool
a -> AnomalyGroupTimeSeriesFeedback
s {$sel:isAnomaly:AnomalyGroupTimeSeriesFeedback' :: Bool
isAnomaly = Bool
a} :: AnomalyGroupTimeSeriesFeedback)

instance
  Prelude.Hashable
    AnomalyGroupTimeSeriesFeedback

instance
  Prelude.NFData
    AnomalyGroupTimeSeriesFeedback

instance Core.ToJSON AnomalyGroupTimeSeriesFeedback where
  toJSON :: AnomalyGroupTimeSeriesFeedback -> Value
toJSON AnomalyGroupTimeSeriesFeedback' {Bool
Text
isAnomaly :: Bool
timeSeriesId :: Text
anomalyGroupId :: Text
$sel:isAnomaly:AnomalyGroupTimeSeriesFeedback' :: AnomalyGroupTimeSeriesFeedback -> Bool
$sel:timeSeriesId:AnomalyGroupTimeSeriesFeedback' :: AnomalyGroupTimeSeriesFeedback -> Text
$sel:anomalyGroupId:AnomalyGroupTimeSeriesFeedback' :: AnomalyGroupTimeSeriesFeedback -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AnomalyGroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
anomalyGroupId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TimeSeriesId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
timeSeriesId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IsAnomaly" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
isAnomaly)
          ]
      )