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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(EventDescription -> EventDescription -> Bool)
-> (EventDescription -> EventDescription -> Bool)
-> Eq EventDescription
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]
(Int -> ReadS EventDescription)
-> ReadS [EventDescription]
-> ReadPrec EventDescription
-> ReadPrec [EventDescription]
-> Read 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
(Int -> EventDescription -> ShowS)
-> (EventDescription -> String)
-> ([EventDescription] -> ShowS)
-> Show EventDescription
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. EventDescription -> Rep EventDescription x)
-> (forall x. Rep EventDescription x -> EventDescription)
-> Generic EventDescription
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' :: Maybe Text -> EventDescription
EventDescription'
    { $sel:latestDescription:EventDescription' :: Maybe Text
latestDescription =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The most recent description of the event.
eventDescription_latestDescription :: Lens.Lens' EventDescription (Prelude.Maybe Prelude.Text)
eventDescription_latestDescription :: (Maybe Text -> f (Maybe Text))
-> EventDescription -> f EventDescription
eventDescription_latestDescription = (EventDescription -> Maybe Text)
-> (EventDescription -> Maybe Text -> EventDescription)
-> Lens EventDescription EventDescription (Maybe Text) (Maybe Text)
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 Core.FromJSON EventDescription where
  parseJSON :: Value -> Parser EventDescription
parseJSON =
    String
-> (Object -> Parser EventDescription)
-> Value
-> Parser EventDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EventDescription"
      ( \Object
x ->
          Maybe Text -> EventDescription
EventDescription'
            (Maybe Text -> EventDescription)
-> Parser (Maybe Text) -> Parser EventDescription
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"latestDescription")
      )

instance Prelude.Hashable EventDescription

instance Prelude.NFData EventDescription