{-# 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.Braket.Types.JobEventDetails
-- 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.Braket.Types.JobEventDetails where

import Amazonka.Braket.Types.JobEventType
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 the type and time events occurred related to the Amazon
-- Braket job.
--
-- /See:/ 'newJobEventDetails' smart constructor.
data JobEventDetails = JobEventDetails'
  { -- | The type of event that occurred related to the Amazon Braket job.
    JobEventDetails -> Maybe JobEventType
eventType :: Prelude.Maybe JobEventType,
    -- | A message describing the event that occurred related to the Amazon
    -- Braket job.
    JobEventDetails -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | TThe type of event that occurred related to the Amazon Braket job.
    JobEventDetails -> Maybe ISO8601
timeOfEvent :: Prelude.Maybe Data.ISO8601
  }
  deriving (JobEventDetails -> JobEventDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobEventDetails -> JobEventDetails -> Bool
$c/= :: JobEventDetails -> JobEventDetails -> Bool
== :: JobEventDetails -> JobEventDetails -> Bool
$c== :: JobEventDetails -> JobEventDetails -> Bool
Prelude.Eq, ReadPrec [JobEventDetails]
ReadPrec JobEventDetails
Int -> ReadS JobEventDetails
ReadS [JobEventDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobEventDetails]
$creadListPrec :: ReadPrec [JobEventDetails]
readPrec :: ReadPrec JobEventDetails
$creadPrec :: ReadPrec JobEventDetails
readList :: ReadS [JobEventDetails]
$creadList :: ReadS [JobEventDetails]
readsPrec :: Int -> ReadS JobEventDetails
$creadsPrec :: Int -> ReadS JobEventDetails
Prelude.Read, Int -> JobEventDetails -> ShowS
[JobEventDetails] -> ShowS
JobEventDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobEventDetails] -> ShowS
$cshowList :: [JobEventDetails] -> ShowS
show :: JobEventDetails -> String
$cshow :: JobEventDetails -> String
showsPrec :: Int -> JobEventDetails -> ShowS
$cshowsPrec :: Int -> JobEventDetails -> ShowS
Prelude.Show, forall x. Rep JobEventDetails x -> JobEventDetails
forall x. JobEventDetails -> Rep JobEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobEventDetails x -> JobEventDetails
$cfrom :: forall x. JobEventDetails -> Rep JobEventDetails x
Prelude.Generic)

-- |
-- Create a value of 'JobEventDetails' 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:
--
-- 'eventType', 'jobEventDetails_eventType' - The type of event that occurred related to the Amazon Braket job.
--
-- 'message', 'jobEventDetails_message' - A message describing the event that occurred related to the Amazon
-- Braket job.
--
-- 'timeOfEvent', 'jobEventDetails_timeOfEvent' - TThe type of event that occurred related to the Amazon Braket job.
newJobEventDetails ::
  JobEventDetails
newJobEventDetails :: JobEventDetails
newJobEventDetails =
  JobEventDetails'
    { $sel:eventType:JobEventDetails' :: Maybe JobEventType
eventType = forall a. Maybe a
Prelude.Nothing,
      $sel:message:JobEventDetails' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:timeOfEvent:JobEventDetails' :: Maybe ISO8601
timeOfEvent = forall a. Maybe a
Prelude.Nothing
    }

-- | The type of event that occurred related to the Amazon Braket job.
jobEventDetails_eventType :: Lens.Lens' JobEventDetails (Prelude.Maybe JobEventType)
jobEventDetails_eventType :: Lens' JobEventDetails (Maybe JobEventType)
jobEventDetails_eventType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobEventDetails' {Maybe JobEventType
eventType :: Maybe JobEventType
$sel:eventType:JobEventDetails' :: JobEventDetails -> Maybe JobEventType
eventType} -> Maybe JobEventType
eventType) (\s :: JobEventDetails
s@JobEventDetails' {} Maybe JobEventType
a -> JobEventDetails
s {$sel:eventType:JobEventDetails' :: Maybe JobEventType
eventType = Maybe JobEventType
a} :: JobEventDetails)

-- | A message describing the event that occurred related to the Amazon
-- Braket job.
jobEventDetails_message :: Lens.Lens' JobEventDetails (Prelude.Maybe Prelude.Text)
jobEventDetails_message :: Lens' JobEventDetails (Maybe Text)
jobEventDetails_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobEventDetails' {Maybe Text
message :: Maybe Text
$sel:message:JobEventDetails' :: JobEventDetails -> Maybe Text
message} -> Maybe Text
message) (\s :: JobEventDetails
s@JobEventDetails' {} Maybe Text
a -> JobEventDetails
s {$sel:message:JobEventDetails' :: Maybe Text
message = Maybe Text
a} :: JobEventDetails)

-- | TThe type of event that occurred related to the Amazon Braket job.
jobEventDetails_timeOfEvent :: Lens.Lens' JobEventDetails (Prelude.Maybe Prelude.UTCTime)
jobEventDetails_timeOfEvent :: Lens' JobEventDetails (Maybe UTCTime)
jobEventDetails_timeOfEvent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobEventDetails' {Maybe ISO8601
timeOfEvent :: Maybe ISO8601
$sel:timeOfEvent:JobEventDetails' :: JobEventDetails -> Maybe ISO8601
timeOfEvent} -> Maybe ISO8601
timeOfEvent) (\s :: JobEventDetails
s@JobEventDetails' {} Maybe ISO8601
a -> JobEventDetails
s {$sel:timeOfEvent:JobEventDetails' :: Maybe ISO8601
timeOfEvent = Maybe ISO8601
a} :: JobEventDetails) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON JobEventDetails where
  parseJSON :: Value -> Parser JobEventDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"JobEventDetails"
      ( \Object
x ->
          Maybe JobEventType
-> Maybe Text -> Maybe ISO8601 -> JobEventDetails
JobEventDetails'
            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
"eventType")
            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
"message")
            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
"timeOfEvent")
      )

instance Prelude.Hashable JobEventDetails where
  hashWithSalt :: Int -> JobEventDetails -> Int
hashWithSalt Int
_salt JobEventDetails' {Maybe Text
Maybe ISO8601
Maybe JobEventType
timeOfEvent :: Maybe ISO8601
message :: Maybe Text
eventType :: Maybe JobEventType
$sel:timeOfEvent:JobEventDetails' :: JobEventDetails -> Maybe ISO8601
$sel:message:JobEventDetails' :: JobEventDetails -> Maybe Text
$sel:eventType:JobEventDetails' :: JobEventDetails -> Maybe JobEventType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JobEventType
eventType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
timeOfEvent

instance Prelude.NFData JobEventDetails where
  rnf :: JobEventDetails -> ()
rnf JobEventDetails' {Maybe Text
Maybe ISO8601
Maybe JobEventType
timeOfEvent :: Maybe ISO8601
message :: Maybe Text
eventType :: Maybe JobEventType
$sel:timeOfEvent:JobEventDetails' :: JobEventDetails -> Maybe ISO8601
$sel:message:JobEventDetails' :: JobEventDetails -> Maybe Text
$sel:eventType:JobEventDetails' :: JobEventDetails -> Maybe JobEventType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe JobEventType
eventType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
timeOfEvent