{-# 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.AWSHealth.Types.EventDescription
-- 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.AWSHealth.Types.EventDescription 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

-- | The detailed description of the event. Included in the information
-- returned by the
-- <https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetails.html DescribeEventDetails>
-- operation.
--
-- /See:/ 'newEventDescription' smart constructor.
data EventDescription = EventDescription'
  { -- | The most recent description of the event.
    EventDescription -> Maybe Text
latestDescription :: Prelude.Maybe Prelude.Text
  }
  deriving (EventDescription -> EventDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventDescription -> EventDescription -> Bool
$c/= :: EventDescription -> EventDescription -> Bool
== :: EventDescription -> EventDescription -> Bool
$c== :: EventDescription -> EventDescription -> Bool
Prelude.Eq, ReadPrec [EventDescription]
ReadPrec EventDescription
Int -> ReadS EventDescription
ReadS [EventDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventDescription]
$creadListPrec :: ReadPrec [EventDescription]
readPrec :: ReadPrec EventDescription
$creadPrec :: ReadPrec EventDescription
readList :: ReadS [EventDescription]
$creadList :: ReadS [EventDescription]
readsPrec :: Int -> ReadS EventDescription
$creadsPrec :: Int -> ReadS EventDescription
Prelude.Read, Int -> EventDescription -> ShowS
[EventDescription] -> ShowS
EventDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventDescription] -> ShowS
$cshowList :: [EventDescription] -> ShowS
show :: EventDescription -> String
$cshow :: EventDescription -> String
showsPrec :: Int -> EventDescription -> ShowS
$cshowsPrec :: Int -> EventDescription -> ShowS
Prelude.Show, forall x. Rep EventDescription x -> EventDescription
forall x. EventDescription -> Rep EventDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventDescription x -> EventDescription
$cfrom :: forall x. EventDescription -> Rep EventDescription x
Prelude.Generic)

-- |
-- Create a value of 'EventDescription' 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:
--
-- 'latestDescription', 'eventDescription_latestDescription' - The most recent description of the event.
newEventDescription ::
  EventDescription
newEventDescription :: EventDescription
newEventDescription =
  EventDescription'
    { $sel:latestDescription:EventDescription' :: Maybe Text
latestDescription =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The most recent description of the event.
eventDescription_latestDescription :: Lens.Lens' EventDescription (Prelude.Maybe Prelude.Text)
eventDescription_latestDescription :: Lens' EventDescription (Maybe Text)
eventDescription_latestDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDescription' {Maybe Text
latestDescription :: Maybe Text
$sel:latestDescription:EventDescription' :: EventDescription -> Maybe Text
latestDescription} -> Maybe Text
latestDescription) (\s :: EventDescription
s@EventDescription' {} Maybe Text
a -> EventDescription
s {$sel:latestDescription:EventDescription' :: Maybe Text
latestDescription = Maybe Text
a} :: EventDescription)

instance Data.FromJSON EventDescription where
  parseJSON :: Value -> Parser EventDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EventDescription"
      ( \Object
x ->
          Maybe Text -> EventDescription
EventDescription'
            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
"latestDescription")
      )

instance Prelude.Hashable EventDescription where
  hashWithSalt :: Int -> EventDescription -> Int
hashWithSalt Int
_salt EventDescription' {Maybe Text
latestDescription :: Maybe Text
$sel:latestDescription:EventDescription' :: EventDescription -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
latestDescription

instance Prelude.NFData EventDescription where
  rnf :: EventDescription -> ()
rnf EventDescription' {Maybe Text
latestDescription :: Maybe Text
$sel:latestDescription:EventDescription' :: EventDescription -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
latestDescription