{-# 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.ApplicationInsights.Types.RelatedObservations
-- 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.ApplicationInsights.Types.RelatedObservations where

import Amazonka.ApplicationInsights.Types.Observation
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

-- | Describes observations related to the problem.
--
-- /See:/ 'newRelatedObservations' smart constructor.
data RelatedObservations = RelatedObservations'
  { -- | The list of observations related to the problem.
    RelatedObservations -> Maybe [Observation]
observationList :: Prelude.Maybe [Observation]
  }
  deriving (RelatedObservations -> RelatedObservations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RelatedObservations -> RelatedObservations -> Bool
$c/= :: RelatedObservations -> RelatedObservations -> Bool
== :: RelatedObservations -> RelatedObservations -> Bool
$c== :: RelatedObservations -> RelatedObservations -> Bool
Prelude.Eq, ReadPrec [RelatedObservations]
ReadPrec RelatedObservations
Int -> ReadS RelatedObservations
ReadS [RelatedObservations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RelatedObservations]
$creadListPrec :: ReadPrec [RelatedObservations]
readPrec :: ReadPrec RelatedObservations
$creadPrec :: ReadPrec RelatedObservations
readList :: ReadS [RelatedObservations]
$creadList :: ReadS [RelatedObservations]
readsPrec :: Int -> ReadS RelatedObservations
$creadsPrec :: Int -> ReadS RelatedObservations
Prelude.Read, Int -> RelatedObservations -> ShowS
[RelatedObservations] -> ShowS
RelatedObservations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RelatedObservations] -> ShowS
$cshowList :: [RelatedObservations] -> ShowS
show :: RelatedObservations -> String
$cshow :: RelatedObservations -> String
showsPrec :: Int -> RelatedObservations -> ShowS
$cshowsPrec :: Int -> RelatedObservations -> ShowS
Prelude.Show, forall x. Rep RelatedObservations x -> RelatedObservations
forall x. RelatedObservations -> Rep RelatedObservations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RelatedObservations x -> RelatedObservations
$cfrom :: forall x. RelatedObservations -> Rep RelatedObservations x
Prelude.Generic)

-- |
-- Create a value of 'RelatedObservations' 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:
--
-- 'observationList', 'relatedObservations_observationList' - The list of observations related to the problem.
newRelatedObservations ::
  RelatedObservations
newRelatedObservations :: RelatedObservations
newRelatedObservations =
  RelatedObservations'
    { $sel:observationList:RelatedObservations' :: Maybe [Observation]
observationList =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The list of observations related to the problem.
relatedObservations_observationList :: Lens.Lens' RelatedObservations (Prelude.Maybe [Observation])
relatedObservations_observationList :: Lens' RelatedObservations (Maybe [Observation])
relatedObservations_observationList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelatedObservations' {Maybe [Observation]
observationList :: Maybe [Observation]
$sel:observationList:RelatedObservations' :: RelatedObservations -> Maybe [Observation]
observationList} -> Maybe [Observation]
observationList) (\s :: RelatedObservations
s@RelatedObservations' {} Maybe [Observation]
a -> RelatedObservations
s {$sel:observationList:RelatedObservations' :: Maybe [Observation]
observationList = Maybe [Observation]
a} :: RelatedObservations) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON RelatedObservations where
  parseJSON :: Value -> Parser RelatedObservations
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RelatedObservations"
      ( \Object
x ->
          Maybe [Observation] -> RelatedObservations
RelatedObservations'
            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
"ObservationList"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable RelatedObservations where
  hashWithSalt :: Int -> RelatedObservations -> Int
hashWithSalt Int
_salt RelatedObservations' {Maybe [Observation]
observationList :: Maybe [Observation]
$sel:observationList:RelatedObservations' :: RelatedObservations -> Maybe [Observation]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Observation]
observationList

instance Prelude.NFData RelatedObservations where
  rnf :: RelatedObservations -> ()
rnf RelatedObservations' {Maybe [Observation]
observationList :: Maybe [Observation]
$sel:observationList:RelatedObservations' :: RelatedObservations -> Maybe [Observation]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Observation]
observationList